objective c - Check whether the request loaded in UIWebView -


i have uiwebview i'm loading url server. working well, page loading in web view. while loading, have show activity indicator.

i have done:

 nsurl *urlstr = [nsurl urlwithstring:myurlstring];   nsurlrequest *req = [nsurlrequest requestwithurl:urlstr];  [webview loadrequest:req]; 

i have added activity indicator this:

activityindicator = [[uiactivityindicatorview alloc]init]; activityindicator.activityindicatorviewstyle=uiactivityindicatorviewstylegray;   activityindicator.frame=cgrectmake(webview.center.x,webview.center.y - 150, 60, 60); [webview addsubview:activityindicator]; 

when have start , stop animating?

for need implement uiwebview delegate.

you can start in -

- (void)webviewdidstartload:(uiwebview *)webview 

and can finish in either -

if success -

- (void)webviewdidfinishload:(uiwebview *)webview 

if fail -

- (void)webview:(uiwebview *)webview didfailloadwitherror:(nserror *)error 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -