更改UIBarButtonItem的宽度 [英] Change the width of an UIBarButtonItem

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

问题描述

如何将 UIBarButtonItem 的宽度更改为29px?属性宽度不起作用,我不想创建 UIButton 并使用 initWithCustomView 因为我想要方形背景调整到导航栏颜色。
我正在使用 initWithImage 来初始化 UIBarButtonItem

How can I change the width of an UIBarButtonItem to 29px? The property width does not work and I don't want to create a UIButton and use the initWithCustomView because I want the square background to adjust to the navigation bar color. I'm using the initWithImage to init the UIBarButtonItem.

这是我的按钮,当前宽度为37px。我想设置为29px。

Here is my button with a current width of 37px. I want to set to 29px.

推荐答案

你不能。如果你想要自定义宽度,你需要使用 initWithCustomView

you cant. If you want custom width you will need to use initWithCustomView

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

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