我遇到的问题是检测到在屏幕上的动画UIView
或UIViewController
动画上的触摸。我试过UITapGesture
,touchesbegan
和UIbutton
. 但我发现问题出在使用动画块时。视图的位置设置为其结束位置,移动时无法触摸。(您可以触摸视图将要停止的位置并触摸读取)。我已经尝试过UIView
动画的动画块。我也尝试过使用CAKeyframeAnimation
,但结果都一样。
[UIView animateWithDuration:10 delay:1 options:(UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction) animations:^{
[testViewController.view setFrame:CGRectMake(900, 20, 100, 100)];
} completion:^(BOOL finished) {
// Animate moving to another location
}];
这是我想要的一个简单示例。我想要一个球在屏幕上随机移动的图像。我想知道什么时候触球。