问题
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