【发布时间】:2014-06-11 20:57:54
【问题描述】:
我最近遇到了我的应用程序的问题。
我经常用
[UIView animateWithDuration:(NSTimeInterval) animations:^{...} completion:^(BOOL finished) {...}];
制作我的动画,直到现在它都运行良好。这是我的问题代码
UIImageView *someimage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"someimage"]];
[someimage setFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubView:someimage];
[UIView animateWithDuration:0.5 animations:^{
[someimage setFrame:CGRectMake(400, 400, 200, 200)];
} completion:^(BOOL finished) {
NSLog(@"Just finish moving some image lets rotate it!");
[UIView animateWithDuration:0.5 animations:^{
someimage.transform = CGAffineTransformMakeRotation(M_PI);
} completion:^(BOOL finished) {
NSLog(@"What just happened?");
}];
}];
我得到了一张图片,我使用动画将它从一个角落移动到另一个位置。然后,当动画完成时,我旋转它,但是当我进行旋转时,UIImageView 再次出现在角落。
谁能解释一下为什么会发生这种情况以及如何处理?
谢谢!
【问题讨论】:
标签: ios animation uiview core-animation catransition