animatewithduration无法正常工作?

时间:2013-10-28 21:01:50

标签: ios animation rotation

嘿所有我正在尝试根据我得到的数据旋转图像。图像会旋转,但没有动画。

这是代码..

UIImage *arrowimage = [UIImage imageNamed:@"arrow"];

NSInteger degrees = [_item.current_value integerValue] ;

NSLog(@"ANIMATION!!");

_imageView.image = arrowimage;
_curvalLabel.text = @"";

[UIView animateWithDuration:5.0 animations:^{
    _imageView.transform = CGAffineTransformMakeRotation(degrees * M_PI / 180.0);
    } completion:^(BOOL finished){
}];

2 个答案:

答案 0 :(得分:0)

试试这个

_imageView.transform = CGAffineTransformRotate(imageView.transform,degrees * M_PI / 180.0);

答案 1 :(得分:0)

您没有看到动画,因为您的约束可能不是“变换友好”。某些类型的约束不适用于自动布局。

发布有关您的约束的信息,或者更好的是,搜索自动布局和转换。

相关问题