UIButton background color for highlighted/selected state issue

前端 未结 6 1874
隐瞒了意图╮
隐瞒了意图╮ 2021-02-18 18:47

I\'ve a UIButton and I\'ve created an extension to add background color for different state.

I\'m using the following code:



        
6条回答
  •  南旧
    南旧 (楼主)
    2021-02-18 19:45

    When your UIButton is selected. If you focus on the button, it will not highlight the button as state .Highlighted. If it is not selected, it will highlight it as your will. For it regards you have background image in your button, it will use the default effect to highlight a image. If you want to change the state to .Selected, you have to set the variable selected of UIButton to true.

提交回复
热议问题