Bir resme 2 saniye boyunca dokunduğumda ve basılı tuttuğumda bir uyarı kutusu aramaya çalışıyorum. İşte ben bugüne kadar ne var:UIImageView'da bir dokunma ve bekletme nasıl uygulanır?
- (void)viewDidLoad
{
[super viewDidLoad];
UILongPressGestureRecognizer *tapAndHoldGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapAndHoldGesture:)];
tapAndHoldGesture.minimumPressDuration = 0.1;
tapAndHoldGesture.allowableMovement = 600;
[self.view addGestureRecognizer:tapAndHoldGesture];
}
- (void) handleTapAndHoldGesture:(UILongPressGestureRecognizer *)gestureRecognizer{
if (gestureRecognizer.state != UIGestureRecognizerStateEnded) {
return;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Gesture:" message:@"hold it" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
bu şey etkileyen, ancak Resim Görünümü programlı sonradan değil, yük oluşturulur emin değilim. Ayrıca
.. herhangi bir yardım takdir olarak şimdiden teşekkürler, ben aşağıdaki bağlantılardan baktım:
Long press gesture on UICollectionViewCell
Long press gesture recognizer on UIButton?
'a ayarladığınızdan emin olun. Yalnızca işleyici yöntemini –
görüyorum Hatam ... viewDidLoad içinde. Teşekkürler. –