iPhone UIButton with UISwitch functionality

前端 未结 4 1642
轮回少年
轮回少年 2020-12-02 09:01

Is there either a way to implement UISwitch with custom graphics for the switch-states? Or as an alternative the other way round, an UIButton with UISwitch functionality?

4条回答
  •  一个人的身影
    2020-12-02 09:52

    UIButton already supports a "switch" functionality.

    Just set a different image in Interface Builder for the "Selected State Configuration", and use the selected property of UIButton to toggle its state.

提交回复
热议问题