Error calling method: error using undeclared identifier

So, I have a declaration and definition below,

-(UIImageView *)returnImageView:(UIImageView *)myImageView color:(UIColor *)imageViewColor x:(int)xParameter y:(int)yParamater width:(int)widthParameter height:(int)heightParameter { CGRect cellFrame = CGRectMake(xParameter, yParamater, widthParameter, heightParameter); style:UITableViewStyleGrouped]; myImageView = [myImageView initWithFrame:cellFrame]; myImageView.backgroundColor =imageViewColor; myImageView.opaque = YES; return myImageView; } 

This method will return the image.

I'm trying to call him

 UIImageView *myImageViews; UIColor *tableColor = [UIColor blueColor] ; [self.view addSubview:[returnImageView:myImageViews color:tableColor x:17 y:10 width:290 height:230]; 

which gives a compiler error when using the undeclared identifier returnImageView. What causes the error?

thanks

+4
source share
1 answer

First of all, there is no square bracket after the last line of code.

Secondly, you must call " self " to get the method!

 [self.view addSubview:[self returnImageView:myImageViews color:tableColor x:17 y:10 width:290 height:230]]; 

Third, you declared your returnImageView method in a relative .h file

 -(UIImageView *)returnImageView:(UIImageView *)myImageView color:(UIColor *)imageViewColor x:(int)xParameter y:(int)yParamater width:(int)widthParameter height:(int)heightParameter; 
+4
source

Source: https://habr.com/ru/post/1395933/


All Articles