Search code examples
xcodeuiwebviewmbprogresshud

xcode : using MBProgressHUD when loading "Twitter" page on uiWebview


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];

Solution

  • ok, I finished by using MBProgressHUD with delay :

        [HUD hide:YES afterDelay:4.7];