ios - WebViewController - display -
i have created webviewcontroller view, displays websites in menu. have 2 cells, contact us, on click of cell shows web view contact , terms of use displays terms .
my question how write code uses 1 of controller.
// controller display web
class webviewcontroller: uiviewcontroller { @iboutlet weak var webview: uiwebview! var urltoshow:string? override func viewdidload() { super.viewdidload() if let url = urltoshow { webview.loadrequest(nsurlrequest(url: nsurl(string: url)!)) } } }
you should use sfsafariviewcontroller instead of webviewviewcontroller.
if ([sfsafariviewcontroller class] != nil) { sfsafariviewcontroller *sfvc = [[sfsafariviewcontroller alloc] initwithurl:url]; sfvc.delegate = self; [self presentviewcontroller:sfvc animated:yes completion:nil]; } else { if (![[uiapplication sharedapplication] openurl:url]) { //nslog(@"%@%@",@"failed open url:",[url description]); } }
pass different url contact , privacy policy. open website in looks navigated in application. thanks
Comments
Post a Comment