Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SFSafariViewController shows incorrectly when pushed in UINavigationController with modalPresentationStyle = .FormSheet

I have a simple Settings table view that is the first view of a UINavigationController.

I present the Settings UINavigationController with the .FormSheet modalPresentationStyle, which means on an iPhone it takes up the full screen, while on an iPad, it displays centered modally.

Now I want want one of the rows in the Settings table to push a SFSafariViewController onto the navigation stack.

This works fine on an iPhone, but on the iPad it does not. iPad screenshot:

enter image description here

Note that the part of the SFSafariViewController navigation bar shows underneath the navigation bar (with the Settings back button). See red rectangle in image.

let urlText = "http://www.apple.com"       
let url = NSURL(string: urlText)!     
let safariViewController = SFSafariViewController(URL: url)
self.navigationController?.pushViewController(safariViewController, animated: true)

On the iPhone, you don't see the SFSafariViewController navigation bar at all - which is perfect for my use case.

Any magic setting to make this work correctly?

like image 272
Daniel Avatar asked Jan 11 '16 08:01

Daniel


1 Answers

SFSafariViewController is available to iOS9.0 or above version of apple os. According to your problem you have facing some problem show some gap in you navigation bar with SFSafariViewController view.because

enter image description here

SFSafariViewController is embed own navigation bar, UISearchbar, UIBarButton.when you push SFSafariViewController from over ViewController then you app navigation bar show over the SFSafariViewController navigation bar.

enter image description here

like image 158
jeet Kumar Avatar answered Oct 13 '22 02:10

jeet Kumar