iOS 9 - hide toolbar at bottom of web page loaded via SFSafariViewController

回眸只為那壹抹淺笑 提交于 2019-12-10 20:24:48

问题


I am attempting to hide the navigation toolbar(go back and forward, open in safari ...) that appears at the bottom of a page that loads a URL using the SFSafariViewController. I tried setting the following property on the navigation controller but it did not work/ [_safariViewController.navigationController setToolbarHidden:YES]; I am able to get this to hide when using a view controller that uses the UIWebView class. Any suggestions?

Thanks


回答1:


What you can do is adjust the frame of the SafariViewController.

let safari = SFSafariViewController(url: URL(string: "https://wwww.google.co.nz")!)
self.present(safari, animated: true) {
    let frame = safari.view.frame
    frame.size = CGSize(width: frame.width, height: frame.height + 44.0)
    safari.view.frame = frame
}



回答2:


Per Apple's documentation on SFSafariViewController, there does not appear to be a publicly-accessible way to hide either the Done button or the URL bar. Apple suggests that you use WKWebView if you need a custom browser interface.

There's a AppCoda tutorial on WKWebView that shows you how to create a ViewController with an embedded WKWebView. Hope that helps!



来源:https://stackoverflow.com/questions/34146531/ios-9-hide-toolbar-at-bottom-of-web-page-loaded-via-sfsafariviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!