[英]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. 大家好,我想知道如何设置单元格中的UIimageView的图像。 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'
它应该是cell.imageView.image = [tempObject objectForKey:@“ CafeImage”];
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"]; 第二-[tempObject objectForKey:@“ CafeImage”]中的数据必须是UIImage类,或者如果它是NSString->使用[UIImage imageName:@“例如-objectForKey”];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.