我想定制我的UIBarButtonItem的外观。这里是我目前使用的代码:iPhone UIBarButtonItem setCustomView:方法?
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(267, 6, 48, 30)];
[editButton setCustomView:button]; // editButton is the UIBarButtonItem
不幸的是,UIButton没有被绘制,即它是100%透明的。 我知道这个按钮是存在的,因为当我添加一行代码,如下所示:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(267, 6, 48, 30)];
[editButton setCustomView:button]; // editButton is the UIBarButtonItem
UIRectFill(button.frame);
我看到一个黑色的方形出现在按钮应该出现的位置。
如何让我的UIButton被绘制?我已经看了很多地方,但似乎没有工作...
,祝你好运。 http://stackoverflow.com/questions/7950644/how-to-customize-uibarbuttonitem-in-ios5 – user1021484 2011-11-01 02:51:56