objective c open links from UIWebView in safari

前端 未结 1 1839
时光说笑
时光说笑 2021-01-28 15:01

I have a UIViewController subclass which includes a UIWebView and implements the UIWebViewDelegate. What i want to do is make links pressed in the UIWebView to open in safari.

1条回答
  •  被撕碎了的回忆
    2021-01-28 15:53

    I noticed that you are not setting the delegate of "articleWebView" after you release it.

    Try using this instead:

    [articleWebView release]; 
    
    articleWebView= [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,380)];  
    
    **articleWebView.delegate = self;** 
    
    [articleWebView loadHTMLString:content baseURL:[NSURL 
    URLWithString:@"http://www.mysite.gr/"]];  
    
    self.view = articleWebView;
    

    0 讨论(0)
提交回复
热议问题