I want to put the view of a UINavigationController into another view controller's view. The problem is that the right bar button is misplaced on iOS 10. On iOS 8 and 9 it looks good.
iOS 8 and 9:
iOS 10:
Here's the code how i add the navigation controller:
override func viewDidLoad() {
super.viewDidLoad()
let viewController = MyViewController()
navController = UINavigationController(rootViewController: viewController)
navController.willMove(toParentViewController: self)
addChildViewController(navController)
navController.view.frame = view.bounds
view.addSubview(navController.view)
navController.didMove(toParentViewController: self)
}
In MyViewController
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .done,
target: self,
action: #selector(doneButtonPressed)
)
}
Also there are no clipped views (except the button itself). See snapshot of IB Debug View Hierachy:
Any ideas?


