开发者

Placeholder image when there is no connectivity to load image with web service

开发者 https://www.devze.com 2023-01-29 05:58 出处:网络
can we get any dummy image when internet connection(or no web services available) is not there ?when we have internet connection i mu开发者_StackOverflow社区st retrieve image fromthe web services....W

can we get any dummy image when internet connection(or no web services available) is not there ?when we have internet connection i mu开发者_StackOverflow社区st retrieve image from the web services....


Why not just have a default image in your project that you load up if you cannot get one from the web service. I am not sure how you are opening the connection. If you are getting some sort of data back from a connection do something like this:

UIImage *theImage;
if(imageData > 0)
   theImage = [UIImage imageWithData:imageData]
else
   theImage = [UIImage imageNamed:@"whateverYourDummyImageNameIs.jpg"];

It really depends on how you are retiriving the image. When your service finishes, just check to see if you have any data; if yes, save the image. If no, load the dummy image.

0

精彩评论

暂无评论...
验证码 换一张
取 消