UINavigationBar是RedColour。如何为BarButton添加背景颜色
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"Hello" style:UIBarButtonItemStylePlain target:self action:@selector(bbPressed:)];
self.navigationItem.rightBarButtonItem=barButton ;
现在我需要给上面的BarButton一个黑色的背景颜色。我如何以编程方式执行此操作?
我试过这个使用IB和它的作品,但我需要使用代码只。
步骤如何在IB中完成;
将背景颜色更改为RED
。 更改样式为 - BlackTranslucent
我试着设置这些使用的代码,但它不起作用。
帮助
检查 http://stackoverflow.com/questions/664930/uibarbuttonitem-with-color – Martin 2012-02-13 14:10:19