Swift - UIButton overriding setSelected

后端 未结 4 1647
心在旅途
心在旅途 2020-12-16 09:53

I\'m making a UIButton subclass in Swift to perform custom drawing and animation on selection

What would be the equivalent in Swift of overriding - (void)setSe

4条回答
  •  悲&欢浪女
    2020-12-16 10:29

    try this

    override public var selected: Bool {
        willSet(selectedValue) {
            self.selected = selectedValue
            // Do whatever you want
        }
    }
    

提交回复
热议问题