How to use a UIButton as a toggle switch

前端 未结 11 790
我在风中等你
我在风中等你 2020-12-02 18:44

I am using a UIButton of custom type and what I want is use it like a toggle switch with the change of image. Like when it is clicked if previously it was not in selected mo

11条回答
  •  星月不相逢
    2020-12-02 18:59

    I believe this post has a better solution : iPhone UIButton with UISwitch functionality

    UIButton has toggling built in. There is a selected property that you can set and change the skins based on the state.

提交回复
热议问题