我有一个简单的方法来为视图添加动画效果。
-(void)animateSelf
{
CABasicAnimation * animation;
animation = [CABasicAnimation animationWithKeyPath:@"position.y"];
// settings ...
[self.view.layer addAnimation:animation forKey:@"position.y"];
animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
// settings ...
[self.view.layer addAnimation:animation forKey:@"transform.rotation.z"];
[UIView animateWithDuration: 1.0 animations:^{
CGRect rect = self.view.frame;
rect.origin.y += 800;
self.view.frame = rect;
} completion:nil];
}
在iOS 7中,它运作良好。但是在iOS 8中,动画表现得不可预测。有没有一种方法可以将这些动画组合起来用于iOS 8?
我尝试用另一个CABasicAnimation替换animateWithDuration:,但没有帮助。 view.frame日志是正确的,但是view.frame的动画跳出了模糊的原点。
删除position.y
(第一个)的CABasicAnimation后,错误消失了。
frame
属性改为center
属性无效。@user3386109 - Oleg Sobolev