ios - Show progress bar until it load the data in UIWebView IOS7 -


hi in application have uiwebview loads pdf file using url large file taking time load. want show user loading progress until load pdf once file loaded has hide progress bar, how can achieve this?

my webview code.

- (void)viewdidload {    [super viewdidload];     nsstring *pdf =@"http://jesusredeems.com/mag/pdf/jre-2014-03.pdf";     nsurl *url = [nsurl urlwithstring:pdf];     nsurlrequest *myrequest = [nsurlrequest requestwithurl:url];    [webview loadrequest:myrequest];  } 

i'm using above code load pdf, how can use progress bar file loading?

you should start/stop progressbar in webview delegate methods.

add following line in viewdidload.

webview.delegate = self; 

add following functions in controller...

-(bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype {     //start progressbar..      return yes; }  -(void)webviewdidfinishload:(uiwebview *)webview {     //stop or remove progressbar }  -(void)webview:(uiwebview *)webview didfailloadwitherror:(nserror *)error {     //stop or remove progressbar , show error } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -