UILabelis a subclass UIView, which in itself is a subclass UIResponder; therefore, of course, you can make a shortcut that responds to touch. Just create a new subclass UILabeland implement the following method (s):
– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesEnded:withEvent:
– touchesCancelled:withEvent:
So, if you want something to happen when you touch it, you do it in -touchesBegan:withEvent:.
If creating a new subclass is too hard for you, then Id will suggest doing as @JustSid suggests and use UIButtonfor the task.
source
share