1

所以我有一个 UITabBarController ,我可以像这样对图像进行着色(我有一个用作背景的图像):

#define TAB_BAR_TINT_COLOR [UIColor colorWithRed:128/255.0 green:128/255.0 blue:128/255.0 alpha:1.0]
#define TAB_BAR_SELECTED_TAB_COLOR [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]

[self.tabBarController.tabBar setTintColor:TAB_BAR_TINT_COLOR];
[self.tabBarController.tabBar setSelectedImageTintColor:TAB_BAR_SELECTED_TAB_COLOR];

要产生这个:

http://img35.imageshack.us/img35/9885/z6po.jpg

但我似乎无法用导航栏做到这一点。每当我尝试调整 barButtonItem 的任何色调时,它都会为背景着色:

    UIBarButtonItem *refreshBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"02-redo.png"] style:UIBarButtonItemStylePlain target:self action:nil];

    [self.navigationItem setRightBarButtonItem:refreshBarButtonItem];
    [self.navigationItem.rightBarButtonItem setTintColor:[UIColor whiteColor]];

http://img580.imageshack.us/img580/1192/5gwf.jpg

非常感谢任何帮助-谢谢!

4

1 回答 1

0

它应该工作。你在哪里写这段代码?-(无效)viewDidLoad;??

于 2013-06-15T00:54:38.510 回答