I have a custom left bar button item, a custom title view, and a custom right bar button item. They are all fixed space items, with the rightBarButton view being defined in the storyboard, and the left and title views defined in code. They are added to the navigation bar as follows:
let leftButton = UIBarButtonItem()
leftButton.customView = myLeftBarView
navigationItem.leftBarButtonItem = leftButton
let rightButton = UIBarButtonItem()
rightButton.customView = myRightBarView
navigationItem.rightBarButtonItem = rightButton
navigationItem.titleView = myTitleView
This used to work fine when my rightBarButtonItem
was small, however, now its around 80px wide and on smaller screen sizes (the iPhone 5 and 5s), the titleView
is pushed over towards the left, and slightly overlaps my leftBarButtonItem
.
How can I fix this?