NavigationBar's titleView label missing after switching to Landscape in Master Detail View Controller

636 views Asked by At

In both portrait and landscape, when I push a UIViewController onto a navigationController stack, the titleView inside the detail VC's navigationBar looks fine.

Landscape: Landscape Portrait:

Portrait

BUT if I rotate the device from portrait to landscape, the titleView goes missing:

Missing

Has anyone encountered this weird bug before? I am not using any custom navigationItems and I'm not manually setting the titleView.

It seems that the titleView's origin is being set out of the bounds of the navigation item after looking at the view hierarchy:

Views

This is on an iPhone 6 Plus running iOS8.3

1

There are 1 answers

3
dwinnbrown On

You could try setting the content of the navigation bar programatically in swift:

viewController.title = "some title"

When put into the view did load: override func viewDidLoad() { super.viewDidLoad() self.title = "some title" }

Try putting inside the viewDidLoad for landscape orientation only:

override func viewDidLoad() {
    super.viewDidLoad()


if(UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation))
    {             
   println("landscape")
self.title = "some title"
    }
}