How to put action on text in xcode?
I don't want to connect action to button, I want when user clicks text that says "Insert" 开发者_StackOverflowto highlight that text (or change color) and call a function.
How to do that?
UILabel doesn't have a function inherently that you could use, however the UITextField has a property called editing that is called when the user taps the text. This may or may not be what you're looking for because the keyboard is usually open during editing of a text field.
In my honest opinion, it really would be easier to use a button in the long run. It's much less work to put an invisible UIButton on top of the text and check to see if the user taps that.
精彩评论