3

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

user4321945
  • 93
  • 2
  • 9

2 Answers2

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
}
Anna Fortuna
  • 1,071
  • 2
  • 17
  • 33
0

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!

Mayank
  • 315
  • 2
  • 13