我想自定义一个UIBarButtonItem的背景。这里是我使用的代码:iPhone UIBarButtonItem setCustomView:方法?
UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
[button setBackgroundImage:[UIImage imageNamed:@"ButtonBackground.png"] forState:UIControlStateNormal];
[editButton setCustomView:button]; // editButton is the UIBarButtonItem
不幸的是,这是行不通的。它不是显示UIBarButtonItem,而是简单地消失(它变成100%透明)。当我省略setCustomView方法时,UIBarButtonItem出现,但未定制。
我该如何解决这个问题?
谢谢!
丰富
我也有类似你的问题,也在等待解决,祝你好运。这是我的问题http://stackoverflow.com/questions/7950644/how-to-custom-uibarbuttonitem-in-ios5 – user1021484 2011-11-01 02:34:29