Reputation: 589
I am developing an iOS app using XCode 4.2
I have a UIImage variable and I am trying to load it in a UIImageView by simply saying imgView=image
but I am getting an error saying :
expected identifier or '('
can someone please assist
thank you
Edited :
I tried the following code :
imgView.image=image;
I am getting this error :
Property 'image' not found on object of type 'imgView'
Upvotes: 0
Views: 3442
Reputation: 27506
You should set the image of an UIImageView like this:
imageView.image = image;
Edit: Here is a more detailed example:
UIImage *image = [UIImage imageNamed:"@image.png"]; // Change "image.png" by the name of your image file
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame]; // frame is a CGRect.
imageView.image = image;
Upvotes: 3