活动指示器未出现
我已在我的 webView
上放置了一个 activtyIndicator
并将其与文件所有者连接。我有一个来自 tableView
的 rss feed,当我单击某个单元格时,它会推送到 webView
。就像这个教程一样。 RSS 教程
但是,当 webView
开始加载时,activityIndicator
根本不会出现。我的 activityIndicator
的 webView
文件的代码如下:
-(void)webViewDidStartLoad:(UIWebView *)webView {
[activityIndicator startAnimating];
activityIndicator.hidden = NO;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicator stopAnimating];
activityIndicator.hidden = YES;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE];
}
大家有什么想法吗?
谢谢。
I have put an activtyIndicator
on my webView
and connected it with the files owner. I have an rss feed from a tableView
and when I click on a cell, it pushes to the webView
. Just like this tutorial. RSS Tutorial
However, when the webView
starts loading, the activityIndicator
doesn't appear at all. The code for my webView
file for the activityIndicator
is below:
-(void)webViewDidStartLoad:(UIWebView *)webView {
[activityIndicator startAnimating];
activityIndicator.hidden = NO;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicator stopAnimating];
activityIndicator.hidden = YES;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE];
}
Any ideas guys?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最常见的错误是您忘记设置 webview 的委托:
[theWebView setDelegate: self];
您已经这样做了吗?或者,如果您将任何 NSLog() 放入
webViewDidStartLoad
中,您会看到输出吗?The most common mistake is that you forget to set the delegate of the webview:
[theWebView setDelegate: self];
Do you do that already? Or, if you put any NSLog() in your
webViewDidStartLoad
, do you see the output?将您的子视图置于前面。
[self BringSubViewToFront:activityindicator];
Bring your subview to front.
[self bringSubViewToFront:activityindicator];
我遇到了同样的问题(在 UIWebView 之上有一个 UIActivityIndicator),并且看不到活动指示器。这就是我所做的:
将活动指示器放在 uiwebview 后面并最初隐藏 uiwebview,然后在加载时显示活动指示器。加载完成后,隐藏微调器并显示 uiwebview。
I had the same problem, (having a UIActivityIndicator on top of my UIWebView), and couldn't see the activity indicator. This is what I did:
Put the activity indicator behind the uiwebview and initially hide the uiwebview, then when loading show the activity indicator. When it is finished loading hide the spinner and show the uiwebview.