iPhone SDK - WebView活动指示器
我对 iPhone SDK 中的 UIWebView 有一个大问题。 我有一个 TabBarApplication,每个选项卡上都有一个 WebView(第一个选项卡除外)。
因为加载视图需要安静一段时间,所以我想显示活动指示器。
这是我用来执行此操作的代码:
-(void)webViewDidStartLoad:(UIWebView *) portal {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; 它
-(void)webViewDidFinishLoad:(UIWebView *) portal{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
不能这样工作...我的第一个选项卡中的 WebView 称为“portal”,这就是我在上面输入它的原因,但如果我使用 WebView 也存在同样的问题。
有什么想法吗?这不可能是真的,这太困难了。 我正在安静地寻找线索一段时间,但没有找到任何可以帮助我构建这样一个(认为很容易)活动指示器的东西。
非常感谢您的努力!
来自德国的问候 托比亚斯
I have a big problem with the UIWebView in iPhone SDK.
I have a TabBarApplication with one WebView on each Tab (except the first).
Because it takes quiet a while to load the views I'd like to show an activity indicator.
Here is the code I'm using in order to do that:
-(void)webViewDidStartLoad:(UIWebView *) portal {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
-(void)webViewDidFinishLoad:(UIWebView *) portal{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
It doesn't work this way... My WebView in the first tab is called "portal", that's why I entered it above, but the same problem exists if I use WebView.
Any ideas? Can't be true that this is soooo difficult.
I'm searching for a clue quiete a while now and found nothing which helped me to build such a (think it's easy) activityindicator.
Thanks a lot for your effort!
Greets from Germany
Tobias
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常使用 UIActivityIndicatorView。
如果您在网络视图之上有一个导航控制器,它可以完美地工作:
要摆脱指示器:
如果您没有使用导航控制器,那么我只需使用较大的样式 UIActivityIndicatorViewStyleWhiteLarge 或将视图放在屏幕上的深色半透明视图,然后在加载完成时将其删除。
I typically use a UIActivityIndicatorView.
If you have a Navigation Controller on top of the web view it works perfectly:
To get rid of the indicator:
If you aren't using a Navigation Controller then I would simply use either the larger style, UIActivityIndicatorViewStyleWhiteLarge OR place the view on top of a dark semi-transparent view on the screen and then remove them on load finish.