iphone - Display Image to UIImageView which comes from Server -
i getting strange issue please if it'll appreciated.
my problem getting image names server through web service ex: abc.png.
now image need attached static url & used display uiimageview.
i have used code:
for (int = 0; i<[[mydic valueforkey:@"posts"] count]; i++) { nsdata *bgimagedata = nil; if ([[[[mydic valueforkey:@"posts"] objectatindex:i] valueforkey:@"post"] valueforkey:@"video_image"] == [nsnull null]) { bgimagedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:@"http://drupal.org/files/issues/no-pre.png"]]; } else { bgimagedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:[nsstring stringwithformat:@"http://sitebildz.com/application/document/video/%@",[[[[mydic valueforkey:@"posts"] objectatindex:i] valueforkey:@"post"] valueforkey:@"video_image"]]]]; } [arrvideoimage addobject:bgimagedata]; } for display in table :
cell.imageview.image = [uiimage imagewithdata:[arrvideoimage objectatindex:indexpath.row]]; but don't know why not working.
thanks.
you're doing wrong. see you're making nsdata in loop. think wait until image download server ??? nope not wait. in case you're adding empty nsdata.
would better use sdwebimage.
1. download it
2. import in project
3. build project (success)
4. import #import "uiimageview+webcache.h" in viewcontroller class
[cell.imageview setimagewithurl:imageurl placeholderimage:[uiimage imagenamed:@"placeholderimagename"]];
Comments
Post a Comment