2013-10-28 56 views
0

嘿,我試圖根據我得到的數據旋轉圖像。圖像確實旋轉,但沒有動畫。animatewithduration無法正常工作?

下面的代碼..

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

你使用自動佈局還是自動調整掩碼?你完成時的 – bilobatum

+0

是_finished == YES_? – nielsbot

+0

@bilobatum自動佈局。如果我打印它nielsbot uhm完成是null? :x – Aelion

回答

0

試試這個

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

沒有區別。圖像旋轉,但沒有動畫。 – Aelion

+0

add [UIView setAnimationRepeatCount:HUGE_VALF]; [UIView setAnimationBeginsFromCurrentState:YES];以上_imageView.transform ... – Rocker

+0

不能改變:\ – Aelion

0

你看不到動畫,因爲你的限制也有可能不是「改造友好」。某些類型的限制條件在自動佈局中效果不佳。

發佈有關您的約束或更好的信息,可以搜索自動佈局和變換。