Get UIImageView using Afnetworking and put it in an array

◇◆丶佛笑我妖孽 提交于 2019-12-04 21:46:46

You can use the setImageWithURLRequest method to give a success message or execute the UI update when it has finished for example using the following method:

- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 
          placeholderImage:(UIImage *)placeholderImage 
                   success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
                   failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;

Here is an example (not tested)

[image setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"host.com/images/1/1.png"]] placeholderImage:[UIImage imageNamed:@"page3.png"] 
                   success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image){ 
                             //reload data here
                   }
                   failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){
                             //handle errors here
                   }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!