<tfoot id='unw4j'></tfoot>
    1. <legend id='unw4j'><style id='unw4j'><dir id='unw4j'><q id='unw4j'></q></dir></style></legend>

      1. <i id='unw4j'><tr id='unw4j'><dt id='unw4j'><q id='unw4j'><span id='unw4j'><b id='unw4j'><form id='unw4j'><ins id='unw4j'></ins><ul id='unw4j'></ul><sub id='unw4j'></sub></form><legend id='unw4j'></legend><bdo id='unw4j'><pre id='unw4j'><center id='unw4j'></center></pre></bdo></b><th id='unw4j'></th></span></q></dt></tr></i><div id='unw4j'><tfoot id='unw4j'></tfoot><dl id='unw4j'><fieldset id='unw4j'></fieldset></dl></div>

          <bdo id='unw4j'></bdo><ul id='unw4j'></ul>
      2. <small id='unw4j'></small><noframes id='unw4j'>

        按住自定义 UIButton 时更改深灰色突出显示的颜色?

        时间:2023-07-07

          <small id='1uaA8'></small><noframes id='1uaA8'>

          <i id='1uaA8'><tr id='1uaA8'><dt id='1uaA8'><q id='1uaA8'><span id='1uaA8'><b id='1uaA8'><form id='1uaA8'><ins id='1uaA8'></ins><ul id='1uaA8'></ul><sub id='1uaA8'></sub></form><legend id='1uaA8'></legend><bdo id='1uaA8'><pre id='1uaA8'><center id='1uaA8'></center></pre></bdo></b><th id='1uaA8'></th></span></q></dt></tr></i><div id='1uaA8'><tfoot id='1uaA8'></tfoot><dl id='1uaA8'><fieldset id='1uaA8'></fieldset></dl></div>
          • <legend id='1uaA8'><style id='1uaA8'><dir id='1uaA8'><q id='1uaA8'></q></dir></style></legend>

                <tbody id='1uaA8'></tbody>

              1. <tfoot id='1uaA8'></tfoot>
                  <bdo id='1uaA8'></bdo><ul id='1uaA8'></ul>
                • 本文介绍了按住自定义 UIButton 时更改深灰色突出显示的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个自定义 UIButton,它是一个云、透明的黑白 .png 文件,没有关闭状态,只有一个图像.当用手指轻敲并按住它时,它会变成深灰色.我正在尝试将那种深灰色改为不那么压抑的东西.该按钮在视图中处于打开状态,而不是在选项卡栏、工具栏或导航控制器中.

                  I have a custom UIButton which is a cloud, transparent black and white .png file, with no down state, just one image. When tapping and holding the finger over it, it turns dark grey. I'm trying to change that dark grey to something a little less oppressive. The button is out in the open in a view, not in a tab bar, tool bar, or navigation controller.

                  我已经尝试过设置 tintColor(文档告诉我它只适用于某些"类型的按钮,没有说明是哪一种).

                  I've already tried setting tintColor (which the documentation helpfully informs me is only suitable for 'some' types of buttons, which no indication as to which).

                  我还尝试更改在 Interface Builder 中可以找到的所有与突出显示颜色、默认状态等相关的内容.没有任何改变.

                  I've also tried changing everything I can find in Interface Builder relating to highlight colours, default states, etc. Nothing has made a difference at all.

                  我什至尝试将按钮自己的图像设置为其 UIControlStateHighlighted 状态,但即使这样,当我将手指放在它上面时也会出现深灰色覆盖层.

                  I've even tried setting the button's own image for its UIControlStateHighlighted state, but even this causes the dark grey overlay to appear when I hold my finger over it.

                  我怎样才能改变这种颜色?我在 SO 上查看了许多其他问题,但无法找到适合我的解决方案.任何帮助将不胜感激!

                  How can I change that colour? I've looked at numerous other issues here on SO and have been unable to find a solution that works for me. Any help would be greatly appreciated!

                  我使用 UIImage 类别解决了问题,该类别添加了一个方法,该方法使用 CoreGraphics 将色调应用于提供的 <代码>UIImage.然后我将那个图像设置为亮点,一切都很好.似乎很多箍拉来改变苹果应该让我们改变的颜色,但是 c'est la vie.

                  I Solved the problem using a category of UIImage which adds a method that uses CoreGraphics to apply a tint to a provided UIImage. I then set THAT image as the highlight, and all is well. Seems a lot of hoop-la to change a colour Apple should've let us change, but c'est la vie.

                  推荐答案

                  您说您为 UIControlStateHighlighted 状态设置了自定义图像.这应该禁用默认行为.

                  You said you set a custom image for the UIControlStateHighlighted state. This should disable the default behaviour.

                  如果您仍然有问题,您可以通过将 adjustsImageWhenHighlighted 属性设置为 NO 来禁用此效果,并使用您想要的任何自定义效果.

                  If you still have problems you can disable this effect by setting the adjustsImageWhenHighlighted property to NO and use whatever custom effect you want.

                  这篇关于按住自定义 UIButton 时更改深灰色突出显示的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 UIImage 放入 UIButton 的简单方法 下一篇:用 ViewContainer 中的按钮隐藏视图容器

                  相关文章

                  <legend id='3kGAD'><style id='3kGAD'><dir id='3kGAD'><q id='3kGAD'></q></dir></style></legend>

                  <small id='3kGAD'></small><noframes id='3kGAD'>

                  • <bdo id='3kGAD'></bdo><ul id='3kGAD'></ul>

                    1. <tfoot id='3kGAD'></tfoot>
                      <i id='3kGAD'><tr id='3kGAD'><dt id='3kGAD'><q id='3kGAD'><span id='3kGAD'><b id='3kGAD'><form id='3kGAD'><ins id='3kGAD'></ins><ul id='3kGAD'></ul><sub id='3kGAD'></sub></form><legend id='3kGAD'></legend><bdo id='3kGAD'><pre id='3kGAD'><center id='3kGAD'></center></pre></bdo></b><th id='3kGAD'></th></span></q></dt></tr></i><div id='3kGAD'><tfoot id='3kGAD'></tfoot><dl id='3kGAD'><fieldset id='3kGAD'></fieldset></dl></div>