How to add custom color in Xcode storyboard color picker?

时间:2016-04-07 10:53:06

标签: ios xcode

I am planning to make theme color of UI elements in application. how we show custom color(Golden Color) like Black color in picker menu

enter image description here

is it possible? like we can add custom Property as shown in snapshoenter image description heret

3 个答案:

答案 0 :(得分:12)

您可以添加自定义颜色,如下所示

  1. 选择颜色属性(背景颜色,文本颜色等)。从选择“其他”选项中显示一个弹出窗口。
  2. enter image description here

    1. 将打开颜色选择器。您可以在此处通过RGB / Hex代码设置自定义颜色,并可以设置不透明度。
    2. enter image description here

      将在“最近使用的颜色”下应用并显示颜色。这是你可以添加自定义颜色的方法,但据我所知你不能在默认列表中添加颜色。

答案 1 :(得分:8)

点击"新建&#34>创建一个新的调色板这里: enter image description here

一个新的调色板"未命名"将被创建。您可以通过再次单击cog并选择"重命名..."来重命名该调色板。然后,您需要单击要捕获颜色的对象,并将这些对象的颜色拖动到颜色芯片区域:

enter image description here

一旦您捕获了颜色,您甚至可以将其重命名为指示其正常使用位置的内容,为收件人提供的信息不仅仅是颜色。

source

答案 2 :(得分:4)

从Xcode 9开始,您可以将颜色添加到资产目录中。 打开资产目录,单击+并添加颜色集。 单击创建的颜色,您可以命名它并使用检查器设置颜色。 此后,该颜色以情节提要板的颜色显示在名为“命名的颜色”的区域中。

相关问题