Auto Layout with UINavigationBar and UIBarButtonItem
问题 I like to create my views as standalone Xib files then instantiate them and add as subviews. So, when working with a UINavigationBar , I expected to be able to do the same thing, first creating my custom view - from the Xib - then adding it as a custom view to the UIBarButtonItem : UIBarButtonItem *anItem = [[UIBarButtonItem alloc] initWithCustomView:_myCustomView]; Then adding to the nav bar: self.navigationBar.topItem.rightBarButtonItems = @[ anItem, anotherItem ]; So far so good. Now,