如何禁用触摸UIBarButtonItem时出现的光? [英] How to disable the light that appears when touching a UIBarButtonItem?
问题描述
我有一个样式为UIBarButtonItemStylePlain
的UIBarButtonItem
工具栏.
我想知道如何禁用触摸时出现的灯光?
I have a toolbar with a UIBarButtonItem
with style: UIBarButtonItemStylePlain
.
I wonder how can I disable the light that appears while touching it?
UIButton
具有showsTouchWhenHighlighted
属性,但是对于UIBarButtonItem
没有这样的事情,您是否可能知道解决方法?
UIButton
has showsTouchWhenHighlighted
property but there is no such a thing for UIBarButtonItem
is there a work-around you might know?
推荐答案
在Interface Builder中,将UIButton
拖到工具栏上.它将创建一个包含UIButton
的UIBarButtonItem
.将UIButton
的类型设置为custom.然后,您可以完全自定义外观.例如,将文本颜色更改为白色,将背景颜色更改为透明,并且当然禁用突出显示.
In Interface Builder drag a UIButton
to the toolbar. It will create a UIBarButtonItem
with a UIButton
in it. Set the type of the UIButton
to custom. Then you can fully customize the appearence. For example change the text color to white and the background color to transparent and of course disable the highlighting.
这篇关于如何禁用触摸UIBarButtonItem时出现的光?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!