Is there a touch method for UILabel?

后端 未结 5 561
不思量自难忘°
不思量自难忘° 2020-12-28 17:41

I\'d like to do an action if someone touches a predeclared UILabel, something like:

if (label is touched) {
    my actions;
}

5条回答
  •  孤独总比滥情好
    2020-12-28 18:35

    By default, UILabel isn't configured to accept touch input. However, if you use a UIButton instead and set it to have a custom appearance, you can make it look like a (single-line) label and have it respond to touch events.

提交回复
热议问题