Open links in Safari instead of UIWebVIew?

后端 未结 7 1106
后悔当初
后悔当初 2020-12-02 20:52

I have an app with a UIWebView inside a UIViewController. I load HTML from a web service as a string like this:

self.webView loadH         


        
7条回答
  •  春和景丽
    2020-12-02 21:13

    Add this line ( self.webview.delegate = self; )

    For Example in viewController.m

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
    [self.webview loadHTMLString:htmlString baseURL:nil];
    self.webview.delegate = self;
    

提交回复
热议问题