How to disable the the light that appears when touching a UIBarButtonItem?

二次信任 提交于 2019-12-05 01:34:18

问题


I have a toolbar with a UIBarButtonItem with style: UIBarButtonItemStylePlain. I wonder how can I disable the light that appears while touching it?

UIButton has showsTouchWhenHighlighted property but there is no such a thing for UIBarButtonItem is there a work-around you might know?


回答1:


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.




回答2:


You can also drop in a UITextField and make it non-editable.



来源:https://stackoverflow.com/questions/4955089/how-to-disable-the-the-light-that-appears-when-touching-a-uibarbuttonitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!