我设置了一个动画块,以便在用户执行搜索时启动。搜索完成后,将推送一个新视图。在用户选择后退按钮并再次尝试搜索之前,这工作正常,现在动画不会启动。
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear)
animations:^{
_collectionImage.transform = CGAffineTransformMakeRotation(M_PI);
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
动画只是在任何人询问之前旋转的光盘,并且在加载推送视图时调用完成块。任何关于为什么它不会在多个搜索中动画的帮助将不胜感激。
谢谢。
这是你的问题...
将仿射值 x 更改为 y
所以现在你的变换值是 y,然后你再次等于 y =y
那么它是如何工作的....
最初您需要存储转换值,然后在完成动画后对其进行动画处理,您需要恢复该值
在viewDidLoad
这样做:
initalTransform=_collectionImage.transform;
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear)
animations:^{
_collectionImage.transform = CGAffineTransformMakeRotation(M_PI);
}
completion:^(BOOL finished){
NSLog(@"Done!");
_collectionImage.transform=initalTransform;
}];
试试这个....这是您需要作为逻辑实现的想法......
使用CGAffineTransformRotate(<#CGAffineTransform t#>, <#CGFloat angle#>)
必须从当前变换开始轮换