xcode:加载“Twitter”时使用 MBProgressHUD uiWebview 上的页面
我正在使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我通过延迟使用 MBProgressHUD 完成了:
ok, I finished by using MBProgressHUD with delay :