UILabel UILongPressGestureRecognizer无法正常工作?

Vic*_*cky 4 iphone uibutton uigesturerecognizer ios

我怎样才能获得UILongPressGestureRecognizeruilabel.当我实现以下代码时,它不会调用该函数.请告诉我,我做错了什么?

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]      initWithTarget:self action:@selector(LabelLongPressed:)];
longPress.minimumPressDuration = 0.5;  // Seconds
longPress.numberOfTapsRequired = 0;

[objlblDuplicate addGestureRecognizer:longPress];
[longPress release];
Run Code Online (Sandbox Code Playgroud)

ada*_*ali 21

默认情况下,UILabel无法获取触摸事件.

objlblDuplicate.userInteractionEnabled = YES;
Run Code Online (Sandbox Code Playgroud)