Resizing was given elsewhere, but to your first question:
Is this method asynchronous?
Yes, it is asynchronous. You can use callback blocks if you want to process the image, for example:
[imageView setImageWithURLRequest:request placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
Then you ask:
Will it cache the image on the iPhone?
If you're just looking for a cache in memory for performance reasons, then the answer is definitely yes. It uses a NSCache (which will be emptied under memory pressure). Aside, it will cache the image as extracted, not reflecting the resizing you make after the fact.
If you are looking for a cache in persistent storage (i.e. a cache that will persist even if you terminate the application and restart it), this question is a little less clear. AFNetworking claims to support caching through the use of NSURLCache , but I had problems working with iOS. If you need persistent storage caching, I would suggest several other UIImageView categories such as SDWebImage .
In any case, for the official AFNetworking line for caching, I can refer to the discussion of Caching in the AFNetworking FAQ.
If you want to see an activity indicator, you can:
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; activityIndicatorView.center = self.imageView.center; [self.view addSubview:activityIndicatorView]; [activityIndicatorView startAnimating]; [imageView setImageWithURLRequest:request placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { [activityIndicatorView removeFromSuperview];