开发者

shouldStartLoadWithRequest not loading links when clicked on in UIWebView

开发者 https://www.devze.com 2023-02-05 12:39 出处:网络
I\'ve started using shouldStartLoadWithRequest and been encountering puzzling behaviour as I understand things.In it\'s most simplest form I\'ve tried the following...

I've started using shouldStartLoadWithRequest and been encountering puzzling behaviour as I understand things. In it's most simplest form I've tried the following...

开发者_开发问答- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
{
  return YES;
}

With the side effect of when I click on HTML links the links do not load new pages in the UIWebView. Very likely I am not understanding something completely here. Any feedback/help would be greatly appreciated.


Two Possible reason

1> either you have not set the delegate Set delegate your webview to your class i.e in viewDidLoad method

webView.delegate = self; 

(if webView is taken in xib file you need to set the delegate from sib file)

2> your class does not implement UIWebViewDelegate protocol i.e. in your interface's declaration you haven,t declare it like this

@interface RootViewController : UIViewController<UIwebViewDelegate>
0

精彩评论

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