Reputation: 2450
In the main view of my app, I have a button that segue's to another view that has a UIWebView
. Usually, it takes about 2-3 seconds to load.. During this awkward loading time, how can a loading image be added and animated?
Example:
Upvotes: 0
Views: 455
Reputation: 108111
You can show/hide a HUD - like SVProgressHUD
or MBProgressHUD
- withing the UIWebViewDelegate
methods.
Set your controller as a delegate and implement, for instance, the two methods
- (void)webViewDidStartLoad:(UIWebView *)webView {
[SVProgressHUD showWithStatus:@"Loading..."];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[SVProgressHUD dismiss];
}
Upvotes: 3