在UINavigationBar中更改UIBarButtonItem的位置 [英] Change position of UIBarButtonItem in UINavigationBar

查看:94
本文介绍了在UINavigationBar中更改UIBarButtonItem的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在UINavigationBar中更改UIBarButtonItem的位置?我希望我的按钮比正常位置高5px。

How can I change the position of a UIBarButtonItem in a UINavigationBar? I would like my button to be about 5px higher than its normal position.

推荐答案

没有特别好的方法可以做到这一点。你最好的选择是你必须是UINavigationBar的子类,并覆盖 layoutSubviews 来调用 [super layoutSubviews] 然后找到并重新定位按钮的视图。

There is no particularly good way to do this. Your best bet if you really must is to subclass UINavigationBar, and override layoutSubviews to call [super layoutSubviews] and then find and reposition the button's view.

这篇关于在UINavigationBar中更改UIBarButtonItem的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆