2

I am trying to download 5MB Image from Server for this I want to display UIActivityIndicatorView still Image completely downloaded and display on UIImageView, so how can display Activity Indicator up to image is loaded into ImageView?

4

3 回答 3

1

Use AsyncImageView .It is the better way to load images asynchronously

于 2012-09-17T13:20:27.457 回答
0

Place an Activity Indicator (via Interface Builder or manually) on your view. Set the property to "hide when not animating".

When doing server call, call [activityIndicator startAnimating] (IBOutlet property). When returning with actual image, call [activityIndicator stopAnimating]. When stopping, it wil automatically hide.

You can also use the activity indicator in the iPhon/Pad status bar. To do this, use [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; Set to NO for hiding it ... (obviously)

Take a look at http://blog.sallarp.com/iphone-uiimage-asynchronously/ for a sample of dl'ing an image. You would stop the activity indicator in the didReceiveData function.

于 2012-09-17T12:52:59.697 回答
0

MonoTouch.Dialog uses a UIActivityIndicatorView when loading new web pages into an UIWebView. It's fairly easy to use, see the corresponding source code here.

于 2012-09-17T14:09:04.730 回答