2012-08-01 83 views
0

我有几个UIViewControllers嵌入在NavigationController中,一切都很酷,当涉及到更改屏幕标题,按钮标题,隐藏/显示导航栏(顶部栏)或工具栏(底部栏),但 - 按导航栏按钮时,我无法强制工具栏按钮具有此动画阴影。更重要的是,工具栏按钮与工具栏一样黑 - 不应该按钮的颜色比工具栏稍浅一些。 我希望它很明显,因为我找不到它,甚至拿出合理的标题UINavigationController工具栏按钮不按动画时按

回答

0

我不能理解你整个问题,但对于工具栏问题,你可以给这些按钮不同的颜色,也可以给一个按钮的颜色改变它被点击

UIBarButtonItem *toolBtn  =  [[UIBarButtonItem alloc] initWithTitle:@"Share and Upload" 
                       style:UIBarButtonItemStyleBordered 
                      target:self 
                      action:@selector(your_Target)]; 

toolBtn.tintColor    =   [UIColor redColor]; 

现在假设toolBtn的效果是你的第一个按钮在工具栏上点击它,你想改变它的颜色,然后在你的目标函数

-(void)your_Target{ 

    UIBarButtonItem *button1  =   [[your_Toolbar items] objectAtIndex:0]; 
    button1.tintColor    =   [UIColor brownColor]; 

// or you can simply loop all toolbar buttons and change the color of only clicked one and for rest keep it default 
} 

希望这将h ELP你..和抱歉我的英文不好:)

0

如果你想有一个黑条(导航或工具栏),设置其barStyleUIBarStyleBlack的补充或替代来着色它的黑色。这让它知道按钮应该有不同的颜色,如果酒吧是任何其他颜色。