Keeping a UIButton selected after a touch

后端 未结 9 1443
后悔当初
后悔当初 2020-11-27 11:41

After my user clicks a button, I\'d like that button to stay pushed during the time that I perform a network operation. When the network operation is complete, I want the bu

9条回答
  •  借酒劲吻你
    2020-11-27 12:31

    "Everything gets better when you turn power on"

        button.selected = !button.selected;
    

    works perfectly... after I connected the outlet to the button in the Interface Builder.

    You do not need to setBackgroundImage:forState:, the builder allows you to specify the background (gets resized if necessary) or/and foreground (not resizing) images.

提交回复
热议问题