I am working on an iOS application that was launched with a standard layout of Master / Detail applications. I have not changed the original layout, except to add an additional segment from the Detail View controller to the new UIViewcontroller, which I represent my class. I would like the navigation bar to be transparent on the view controller that I added, and I have found many examples of how to do this on the Internet. The problem I am facing is that when testing on the ipad the navigation bar is transparent as expected, but on the Iphone, no matter what I do, the navigation bar remains the same.
I am launching the beta version of Xcode 7 and everything is encoded in Swift.
In my viewDidLoad function for my View Controller, I have the following lines of code:
self.navigationController!.navigationBar.translucent = true; self.navigationController!.navigationBar.shadowImage = UIImage() self.navigationController!.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) self.navigationController.navigationBar.backgroundColor = UIColor.ClearColor()
I tried these lines in several ways ... here are some of the things I tried
- run these lines in viewWillAppear.
- Executing the same base code for an object returned from UINavigationBar.appearance ()
- get the parent view controller and run the same settings in its navigation bar object.
None of these changes affected behavior. It appears that any iOS device where the main view controller displays the first full-screen mode leaves the navigation bar normally. While any device displaying a part view or both views first shows a transparent navigation bar. I think I need to open the navigation bar differently in these scenarios .. but I have no ideas.
Thanks!
source share