在iOS中为“更多”选项卡设置导航栏按钮样式

时间:2011-08-14 21:18:29

标签: iphone ios uinavigationcontroller uinavigationbar

我似乎无法改变导航栏按钮stye的样式。这是我得到的。

enter image description here

我将UINavigationController子类化并执行以下操作:

- (id)initWithRootViewController:(UIViewController *)rootViewController
{
    self = [super initWithRootViewController:rootViewController];

    if (self) 
    {
        UINavigationBar *navBar = [self navigationBar];
        [navBar setBarStyle:UIBarStyleBlack];
        [navBar setTintColor:[UIColor blackColor]];
    }

    return self;
}

我正在运行iOS 4.3,当UITabBarController中存在超过4个选项卡时,操作系统会自动添加该按钮。

有关我可能做错的任何建议吗?

2 个答案:

答案 0 :(得分:1)

由于操作系统处理的导航控制器越多,您就必须这样做。

[self.tabBarController.moreNavigationController.navigationBar setTintColor:[UIColor blackColor]];

答案 1 :(得分:0)

如果它自己添加,我认为您需要将self.navigationItem或self.navigationController更改为您想要的,而不仅仅是您自定义的?