我有一組圖像面向一側(人面向右側),我用它翻轉它,然後將它添加到uiimageview的animationImages中。但是,在添加翻轉的圖像後,開始生成動畫後,動畫仍然面向右側。UIImageView的開始動畫沒有動畫翻轉圖像
manRunAnimations = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 64, 64)];
NSArray *manAniRunArray = @[[UIImage imageNamed:@"robot1"],
[UIImage imageNamed:@"robot2"],
[UIImage imageNamed:@"robot3"],
[UIImage imageNamed:@"robot4"],
[UIImage imageNamed:@"robot5"],
[UIImage imageNamed:@"robot6"],
];
manRunAnimationsf = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 64, 64)];
NSMutableArray *flippedRunAnimationImages = [[NSMutableArray alloc] init];
for(UIImage *image in manAniRunArray)
{
UIImage * flippedImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationRightMirrored];
[flippedRunAnimationImages addObject:flippedImage];
}
manRunAnimationsf.animationImages = (NSArray *)flippedRunAnimationImages;
testImgView.image = [manRunAnimationsf.animationImages objectAtIndex:0];
manRunAnimationsf.animationDuration = runAnimationSpeedSlider.value;
[manRunAnimationsf startAnimating];
我使用
testImgView.image = [manRunAnimationsf.animationImages objectAtIndex:5];
這將顯示翻轉圖像的一個正確屏幕上我做了
[manRunAnimationsf startAnimating];
之前一旦開始,動畫甚至測試它根本不翻轉!
任何人都知道爲什麼?
你們認爲與使用「imageNamed」方法的緩存圖像有某種關係? – mskw