I can adjust the height of my title in the navigation bar by:
self.profileNavigationBar.setTitleVerticalPositionAdjustment(10, forBarMetrics: UIBarMetrics.Default)
But I cannot adjust the button in the navigation bar to fit the title position.
The setting button is at an awkward position now. I tried
self.navigationItem.rightBarButtonItem?.setTitlePositionAdjustment(UIOffsetMake(20, 10), forBarMetrics: UIBarMetrics.Default)
self.navigationItem.rightBarButtonItem?.setBackButtonBackgroundVerticalPositionAdjustment(10, forBarMetrics: UIBarMetrics.Default)
self.navigationItem.rightBarButtonItem?.setBackButtonTitlePositionAdjustment(UIOffsetMake(20, 20), forBarMetrics: UIBarMetrics.Default)
none of them works for me. Anyone has ideas? Thanks a lot!
I kind of figure it out.
Select the button in the storyboard, adjust the Edge Inset under Attributes Inspector.
Try this to adjust the vertical position:
navigationItem.rightBarButtonItem?.setBackgroundVerticalPositionAdjustment(10.0, for: .default)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With