【问题标题】:UINavigationController toolbar buttons not animating when pressedUINavigationController 工具栏按钮在按下时没有动画
【发布时间】:2012-07-30 07:11:08
【问题描述】:

我在 NavigationController 中嵌入了一些 UIViewController,在更改屏幕标题、按钮标题、隐藏/显示导航栏(顶部栏)或工具栏(底部栏)时,一切都很酷,但是 - 我不能强制工具栏按钮具有按下时这个动画阴影,就像导航栏按钮一样。更重要的是,工具栏按钮和工具栏一样黑色 - 按钮不应该比工具栏颜色稍浅吗? 我希望它很清楚,因为我找不到它甚至想出合理的标题

【问题讨论】:

    标签: iphone ios xcode uinavigationcontroller uitoolbar


    【解决方案1】:

    我无法理解您的整个问题,但对于工具栏问题,您可以为这些按钮赋予不同的颜色,也可以产生改变被点击按钮颜色的效果

    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
    }
    

    希望这会对你有所帮助.. 对不起我的英语不好:)

    【讨论】:

      【解决方案2】:

      如果您想要一个黑条(导航或工具栏),请将其 barStyle 设置为 UIBarStyleBlack 以添加或代替将其着色为黑色。这让它知道按钮的颜色应该与条的颜色不同。

      【讨论】:

        猜你喜欢
        • 2011-07-15
        • 1970-01-01
        • 1970-01-01
        • 2012-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-20
        • 1970-01-01
        相关资源
        最近更新 更多