可能重复:
How to resize UIBarButtonItem in code
我尝试使用IB设置UIBarButtonItem的大小,但没有成功。

我想缩小宽度,增加高度。我该怎么做呢?有什么建议吗?设置宽度属性(如上图所示)似乎不会改变任何东西。我尝试以编程的方式设置它,如下所示:
UIBarButtonItem *historyButton = [[UIBarButtonItem alloc]
initWithTitle:@"History" style:UIBarButtonItemStyleBordered target:self action:@selector(history:)];
historyButton.width = 3.0;这也改变不了什么。
这是试图修复的条形按钮(红色的按钮):

发布于 2012-05-15 22:21:32
您需要调整UIBarButtonIte的帧大小
例如:
historyButton.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);在本教程中可以看到:
http://iphone-dev-kitchan.blogspot.fr/2010/05/customizing-uibarbutton-on.html
https://stackoverflow.com/questions/10608772
复制相似问题