0

在 xcode 上,我有一个 imageView,我想移动到一个位置然后旋转它......但它不会工作......当添加变换线时,imageView 恢复到其原始位置。在盯着相同的代码 6 小时后,我正要认输,但我想我会再试一次......

代码如下:

fourImageView.center = CGPointMake(80.0f, 108.0f);
twoImageView.center = CGPointMake(80.0f, 108.0f);

[UIView animateWithDuration:0.65f
                      delay:0.5f
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^
 {
     fourImageView.transform = CGAffineTransformMakeRotation(-0.22f);
 } completion:nil];

fourImageView 和 twoImageView 都是 UIImageViews 并声明为(非原子,弱),并作为出口链接到各自的视图。

我什至尝试添加到最后:

fourImageView.center = CGPointMake(80.0f, 108.0f);

但可惜没有这样的运气:(

4

1 回答 1

0
[UIView beginAnimations:@"nameofAnimation" context:nil];
[UIView setAnimationDuration:0.5];
fourImageView.transform = CGAffineTransformMakeRotation(M_PI_2);
[UIView commitAnimations];

这会将您的图像旋转 90°

于 2012-11-11T19:25:30.040 回答