xcode:加载“Twitter”时使用 MBProgressHUD uiWebview 上的页面

发布于 2025-01-06 03:57:04 字数 687 浏览 3 评论 0原文

我正在使用 MBProgressHUD 在加载一些网页时显示微调器。

对于某些网站,它效果很好,但是当尝试打开“twitter”帐户页面时,旋转器仍然在屏幕上,这意味着 Web 视图尚未完成加载。.

这是我的代码,适用于 twitter 以外的其他网站:

- (void)webViewDidStartLoad:(UIWebView *)web
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Loading..";
}

- (void)webViewDidFinishLoad:(UIWebView *)web
{

[MBProgressHUD hideHUDForView:self.view animated:YES];
}

并在 ViewDidLoad 中:

NSURL *urlAddress = [NSURL URLWithString: @"https://twitter.com/#!/Applicaphone"];     
NSURLRequest *requestObject = [NSURLRequest requestWithURL:urlAddress];
[webView loadRequest:requestObject];

I'm using MBProgressHUD to show spinner while loading some web pages.

for some sites, it works great, but when trying to open a "twitter" account page, the spinner still on the screen, meaning that the web view did not finish loading yet..

Here is my code that works for others sites than twitter :

- (void)webViewDidStartLoad:(UIWebView *)web
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Loading..";
}

- (void)webViewDidFinishLoad:(UIWebView *)web
{

[MBProgressHUD hideHUDForView:self.view animated:YES];
}

and in ViewDidLoad :

NSURL *urlAddress = [NSURL URLWithString: @"https://twitter.com/#!/Applicaphone"];     
NSURLRequest *requestObject = [NSURLRequest requestWithURL:urlAddress];
[webView loadRequest:requestObject];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

昔梦 2025-01-13 03:57:04

好的,我通过延迟使用 MBProgressHUD 完成了:

    [HUD hide:YES afterDelay:4.7];

ok, I finished by using MBProgressHUD with delay :

    [HUD hide:YES afterDelay:4.7];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文