Я использую анимацию CABasic
для перемещения UIImageView
. UIImageView
не обнаруживает прикосновения теперь, как включить взаимодействие пользователя после завершения анимации?Как включить взаимодействие в представлении изображения при завершении анимации
[ImageView setUserInteractionEnabled:NO];
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
theAnimation.duration=1;
theAnimation.repeatCount=1;
theAnimation.autoreverses=NO;
theAnimation.fromValue=[NSNumber numberWithFloat:0];
theAnimation.toValue=[NSNumber numberWithFloat:self.view.frame.size.width/2];
theAnimation.removedOnCompletion = NO;
theAnimation.fillMode = kCAFillModeForwards;
[CATransaction setCompletionBlock:^{
NSLog(@"finished");
self.view.userInteractionEnabled = true;
}];
[ImageView.layer addAnimation:theAnimation forKey:@"slide"];
[CATransaction commit];
Вы устанавливаете '[ImageView setUserInteractionEnabled: NO];' but 'self.view.userInteractionEnabled = true'; вы должны попробовать '[ImageView setUserInteractionEnabled: YES];' вместо – LoVo
'[CATransaction setCompletionBlock:^{ NSLog (@« закончен »); self. ImageView.userInteractionEnabled = true; }]; ' – Mahesh
его не работает – Sumi