开发者

Change the html in my webView

I want to change the .html in my webView from my modalViewController, but not always the same, I mean, I want to know some function that can tell me wich .html is in the s开发者_开发百科creen, so I can change it for the next one, like a modalView controller but with .html files. Can I do that?


You can use the webview delegates methods to accomplish that

To know what html file is being called, use

-(BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;

and to know which url is being called you could do something like

-(BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

    NSString *url = [[request URL] absoluteString];

    NSLog(@"my url is %@", url);

    return YES;

}


-(BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

NSString *url = [[request URL] absoluteString];

NSLog(@"my url is %@", url);

return YES;

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜