UILabel UILongPressGestureRecognizer不工作?
如何获得UILongPressGestureRecognizer
上的UILongPressGestureRecognizer当我实现下面的代码,它不会调用该函数。 那么请告诉我我做了什么错事?
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(LabelLongPressed:)]; longPress.minimumPressDuration = 0.5; // Seconds longPress.numberOfTapsRequired = 0; [objlblDuplicate addGestureRecognizer:longPress]; [longPress release];
默认情况下,UILabel无法获得触摸事件。
objlblDuplicate.userInteractionEnabled = YES;