UILabel UILongPressGestureRecognizer not working?

How can I get the UILongPressGestureRecognizer on uilabel.when I implement the following code, it does not call the function. So please tell me what I did wrong?

 UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(LabelLongPressed:)]; longPress.minimumPressDuration = 0.5; // Seconds longPress.numberOfTapsRequired = 0; [objlblDuplicate addGestureRecognizer:longPress]; [longPress release]; 
+4
source share
1 answer

By default, UILabel cannot receive touch events.

 objlblDuplicate.userInteractionEnabled = YES; 
+19
source

Source: https://habr.com/ru/post/1412715/


All Articles