我有一组面向一侧的图像(面向右侧的人),我正在使用这种方法翻转它,然后将其添加到 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];
一旦开始,动画根本不会翻转!!
有谁知道为什么?