1
私はUILongPressGestureRecognizerを使用すると、2度目にしか動作しません... 3秒間ボタンを押しても動作しませんが、2度目は3秒押しますボタンは正常に動作します...いくつかのアイデア?UILongPressGestureRecognizerは、2度目の呼び出しのみです
-(IBAction)seleccionar1:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[sender addGestureRecognizer:longpressGesture];}
-(IBAction)seleccionar2:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[sender addGestureRecognizer:longpressGesture];}
- (void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer{
if(gestureRecognizer.view==boton1)
{
[boton1 setTitle:@"Funciona 1" forState:UIControlStateNormal];
}
if(gestureRecognizer.view==boton2)
{
[boton2 setTitle:@"Funciona 2" forState:UIControlStateNormal];
}}
すべてのお友達に感謝します。
敬具