Is it possible to assign an accessibility action to a UILabel?

前端 未结 5 1633
轻奢々
轻奢々 2021-01-18 19:32

In our current UI, next to certain labels, we have a help-tip button that when clicked, explains the details of what the label references. As such, VoiceOver identifies the

5条回答
  •  长情又很酷
    2021-01-18 20:01

    In your UILabel subclass, override accessibilityActivate() and implement whatever double-tapping should do:

    override func accessibilityActivate() -> Bool {
        // do things...
        return true
    }
    

    If the action can fail, return false in those instances.

提交回复
热议问题