【问题标题】:Setting UIBarItems to red/blue colors将 UIBarItems 设置为红色/蓝色
【发布时间】:2011-02-26 12:01:29
【问题描述】:

UIBarItems 是如何设置为蓝色和红色的?

项目有哪些属性允许这样做?

【问题讨论】:

    标签: iphone


    【解决方案1】:

    好吧,您可以设置一个属性来为 UIBarButtonItem 赋予蓝色,就是将 style 属性设置为 UIBarButtonItemStyleDone。

    您可以在您的 UIToolBar 上设置 tintColor 属性,该属性还将为栏中的任何 UIBarButtonItems 着色。

    【讨论】:

    • Simon +1,因为这是正确的方法,无需对按钮进行任何自定义实现...
    • 谢谢,这很好用。获取红色按钮的属性是什么,比如删除。
    • 您可能需要子类化或使用自定义视图的红色。我不知道有一种内置方法可以让按钮的颜色不是蓝色或它所在的工具栏的色调。 this SO question 的答案中有一些代码可以为您提供一个起点。
    猜你喜欢
    • 2014-08-26
    • 1970-01-01
    • 1970-01-01
    • 2013-10-05
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 2017-08-19
    • 2019-02-07
    相关资源
    最近更新 更多