Get rid of the space on the right side of a UINavigationBar

喜欢而已 提交于 2019-12-01 06:39:38

There would be two solutions. (It may not be exact solution)

1) You should subclass UINavigationBar and play around with it. For example you may have to draw your UIBarButtonItem yourself in the right corner.

2) Instead of using UINavigationBar, Use UIView and add subviews to make it exactly look like the UINavigationBar and use it.

I hope second solution would be easy to achieve in your requirement. I don't think there would be any other way to achieve your requirement.

Balu

There is no option for customizing the default navigation bar button items(back button, right bar button and left barbutton ) in navigation bar. For getting your requirement you can use custom navigation bar.

The second solution you mention actually works (tested today on both iOS6 & 7). The problem is that the elments of the rightBarButtonsItem array are displayed from right to left; this means that the negative space actually needs to appear as first item of the array to achieve the desired effect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!