Luc
Luc

Reputation: 60

How can I change the image displayed in an UIImageView in a cell programmatically?

Hi Guys i was wondering how to set the image of an UIimageView that is in a cell. I'm rather new to coding so please fully explain if u can. I currently have this:

cell.image.image = [tempObject objectForKey:@"CafeImage"];

But the app crashes with this everytime:

-[PFFile imageAsset]: unrecognized selector sent to instance 0x7a96cd80 2015-02-22 15:06:19.616 Cafe[12830:140389] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PFFile imageAsset]: unrecognized selector sent to instance 0x7a96cd80'

Upvotes: 0

Views: 51

Answers (2)

LLIAJLbHOu
LLIAJLbHOu

Reputation: 1313

first - If you are using a standard cell, you should set

cell.imageView.image = "UIImage object";

second - Data in [tempObject objectForKey:@"CafeImage"] must be kind of UIImage class, or if it's NSString -> use [UIImage imageName:@"for example - objectForKey"];

Upvotes: 0

Teja Nandamuri
Teja Nandamuri

Reputation: 11201

It should be cell.imageView.image=[tempObject objectForKey:@"CafeImage"];

Upvotes: 1

Related Questions