繁体   English   中英

animatewithduration不起作用?

[英]animatewithduration not working?

嘿,我正在尝试根据获取的数据旋转图像。 图像确实旋转,但是没有动画。

这是代码。

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){
}];

尝试这个

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM