【问题标题】:problem to give colors for BarButtonItem为 BarButtonItem 提供颜色的问题
【发布时间】:2023-03-16 00:16:01
【问题描述】:

我的视图控制器中有一个工具栏。我需要在工具栏的右侧显示一个图标。 所以我添加了一个 BarButton 项目并在那里显示图标图像。但是图标颜色有问题。它显示为黑色,看起来不太好,也无法在工具栏的右侧排列 Barbutton 项目。谁能告诉我一个很好的方法。请帮助我在右侧安排 barbuttonitems 并提供一种为 BarButtonItem 提供颜色的方法。

【问题讨论】:

    标签: iphone objective-c xcode uibarbuttonitem rightbarbuttonitem


    【解决方案1】:

    使用下面更改UIToolBar的颜色。

    //选择颜色。

      myToolbar.tintColor = [UIColor darkGrayColor];
    

    要对齐右侧按钮,您需要使用类型为 UIBarButtonSystemItemFlexibleSpace 的条形按钮 阅读 SO 帖子。

    Aligning UIToolBar items

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-26
      • 2012-09-01
      • 1970-01-01
      • 2022-01-03
      • 2018-03-07
      • 1970-01-01
      • 2010-10-27
      • 2023-03-18
      相关资源
      最近更新 更多