iphone - Why are my images not displayed -
i have class inherits uiviewcontroller lets call 'controller' outlet uicollectionview. class inherited uicollectioncell lets call 'a' , uiimage lets call 'b', has outlet of b
i wrote following code in 'controller':
- (uicollectionviewcell *)collectionview:(uicollectionview *)p_collectionview cellforitematindexpath:(nsindexpath *)p_indexpath { uicollectionviewcell* cell = [self getuicollectionviewcellfromcollectionview:p_collectionview atindexpath:p_indexpath]; if([cell iskindofclass:[imagecollectionviewcell class]] == yes) { //draw image inside view imagecollectionviewcell* imagecell = (imagecollectionviewcell*)cell; nsstring* imageurl = self.objecttoshow.imagesurl[p_indexpath.item]; uiimage* currentimage = [[uiimage alloc] initwithcontentsoffile:imageurl]; imagecell.imageview.image = currentimage; } return cell; } everything initialized correctly images not displayed, have no clue why is.
can me?
initwithcontentsoffile: expects file path, not url. if you're using url, should using initwithcontentsofurl: takes nsurl (not nsstring), you'll have pass [nsurl urlwithstring: imageurl].
Comments
Post a Comment