PlugInBoy
PlugInBoy

Reputation: 989

Update left NavigationItems in iOS 11

I have app in Apple Store that show 1 or 2 icons on the left of Navigation Item.

When you are in the main view, you only view a burger button to show left menu, but, when you select one of the options in the left menu, change the View and show the burguer button and a left arrow to go back.

In Xcode8 iOS10 compilation it works correctly but, in Xcode9 iOS11, does not update the leftBarButtonItems.

I have 2 functions, one (createMenuBarIcon()) returns the UIBarButtonItem for the burguer menu button and the other (createBackBarMenuIcon()) returns another UIBarButtonItem for the left arrow.

This is the code which I use to put the ButtonItems on the left:

self.navigationItem.leftItemsSupplementBackButton = true
self.navigationItem.setLeftBarButtonItems([createBackBarMenuIcon(), createMenuBarIcon()], animated: true)

UPDATE 1

This is after I call setLeftBarButtonItems and the BackButton not appear. Another thing I see is that I insert self.navigationItem.titleView but it's not in the view hierarchy.

enter image description here enter image description here

UPDATE 2

Ok, I found the problem. In de Controller I have keyWindow.rootViewController = self only in the first viewController of the hyerarchy of NavigationController

Upvotes: 0

Views: 374

Answers (1)

rpstw
rpstw

Reputation: 1712

UINavigationBar use AutoLayout inside since iOS 11,check the view hierarchy to see if there are any layout conflicts.

Upvotes: 0

Related Questions