Determining the current state of a cell

前端 未结 4 1586
孤独总比滥情好
孤独总比滥情好 2021-02-01 10:01

I know that a subclass of UITableViewCell can implement willTransitionToState and execute custom code at the time of transition. But is there any way t

4条回答
  •  忘掉有多难
    2021-02-01 10:28

    Starting from swift 3 the value of state is an OptionSet, you can use it like this:

    override func willTransitionToState(state: UITableViewCellStateMask) {
        super.willTransitionToState(state)
        if state.contains(.DefaultMask) {
            print("DefaultMask")
        }
        if state.contains(.ShowingEditControlMask) {
            print("ShowingEditControlMask")
        }
    }
    

提交回复
热议问题