活动指示器未出现

发布于 2024-11-18 16:38:04 字数 917 浏览 3 评论 0原文

我已在我的 webView 上放置了一个 activtyIndi​​cator 并将其与文件所有者连接。我有一个来自 tableView 的 rss feed,当我单击某个单元格时,它会推送到 webView。就像这个教程一样。 RSS 教程

但是,当 webView 开始加载时,activityIndi​​cator 根本不会出现。我的 activityIndi​​catorwebView 文件的代码如下:

-(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

难忘№最初的完美 2024-11-25 16:38:04

最常见的错误是您忘记设置 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?

茶色山野 2024-11-25 16:38:04

将您的子视图置于前面。 [self BringSubViewToFront:activityindicator];

Bring your subview to front. [self bringSubViewToFront:activityindicator];

﹎☆浅夏丿初晴 2024-11-25 16:38:04

我遇到了同样的问题(在 UIWebView 之上有一个 UIActivityIndi​​cator),并且看不到活动指示器。这就是我所做的:

将活动指示器放在 uiwebview 后面并最初隐藏 uiwebview,然后在加载时显示活动指示器。加载完成后,隐藏微调器并显示 uiwebview。

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [spinner startAnimating];
    [spinner setHidden:FALSE];
    [loadButton setHidden:TRUE];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [spinner stopAnimating];
    [myWebView setHidden:FALSE];
}

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.

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [spinner startAnimating];
    [spinner setHidden:FALSE];
    [loadButton setHidden:TRUE];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [spinner stopAnimating];
    [myWebView setHidden:FALSE];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文