我正在以编程方式创建按钮,并且它们是动画的(淡入淡出和移动),但我需要按钮仍然具有用户交互。我尝试过类似的事情
选项:(UIViewAnimationOptionAllowUserInteraction
这似乎无济于事:/我在这里阅读了几篇不同建议的帖子,包括有人说这实际上是不可能的。有谁知道我是否可以在按钮动画时启用用户交互,如果不可能,人们如何解决这个问题?
谢谢你。
这是我正在使用的当前动画代码:
[UIView animateWithDuration:106
delay:0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionAllowAnimatedContent | UIViewAnimationOptionCurveEaseInOut)
animations:^{
[_planetButton setCenter:point];
_planetButton.alpha = 0.2;
_planetButton.userInteractionEnabled = YES;
}
completion:^(BOOL finished){
NSLog(@"animation completed");
//[_planetButton removeFromSuperview];
}
];
我还尝试了动画,例如:
CABasicAnimation *move = [CABasicAnimation animationWithKeyPath:@"transform2"];
move.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
move.duration = 5.105;
move.repeatCount = 1;
move.autoreverses = YES;
move.removedOnCompletion = YES;
move.toValue = [NSValue valueWithCGPoint:point];
[_planetButton.layer addAnimation:move forKey:nil];