I have a acitivity indicator and a webview. When I place the indicator on top of the webview, the acitivity indicator is not shown.
I have tried the option of placing webview and activity indicator separately. When I do the same, the indicator is shown but when I place it on top of the webview the indicator is not shown.
I have tried the option of setting the background to be black for the indictor and for the webview i have kept the same to be white.
Can anyone pls help me on the same.
Below is the code
@synthesize webView, acitivityIndicator;
- (void)viewDidLoad {
[super viewDidLoad];
// Create a URL object
NSURL *url = [NSURL URLWithString:urlAddress];
NSLog(@"URL address is: %@", urlAddress);
//URL Request Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView
webView.delegate = self ;
[[self view] addSubview:[self webView]];
[[self webView] loadRequest:requestObj];
}
- (void) webViewDidStartLoad:(UIWebView *)webView {
NSLog(@"Web view did start loading");
ac开发者_如何学运维itivityIndicator.hidden = NO;
[acitivityIndicator startAnimating];
}
- (void) webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"Web view did finish loading") ;
[acitivityIndicator stopAnimating];
}
The UIWebView
itself may have a white background, so that's why you don't see the UIActivityIndicator
.
You should make sure that:
- Your
UIActivityIndicatorView
is set to gray. - Your
UIActivityIndicatorView
is "below" theUIWebView
on Interface Builder. The items at the bottom really are at the top.
This is an example:
精彩评论