UIImageanimation与UIView动画块
问题描述:
我想使用UIView动画与块而不是UIImageview动画。由于我需要知道何时完成动画,我决定使用UIView动画与我刚刚新推出的块。 所以,我想这一点:UIImageanimation与UIView动画块
NSMutableArray *mixedimages = [[NSMutableArray alloc] initWithCapacity:5];
for(int count = 1; count <= 5; count++)
{
NSString *fileName = [NSString stringWithFormat:@"Picture_%d.jpg", count];
UIImage *frame = [UIImage imageNamed:fileName];
[mixedimages addObject:frame];
}
gamePicture.animationImages = mixedimages;
gamePicture.animationDuration = 1;
gamePicture.animationRepeatCount = 10;
[gamePicture startAnimating];
进入这个:
[UIView animateWithDuration:1 animations:^{
//animation code here
} completion:^(BOOL finished)
{
NSLog(@"Animation finished");
}];
但我不知道填写什么样的代码中,将做到上面一样,所以,我将有同样的的动画。
答
您不能使用UIView动画来为UIImageView的内容设置动画。 UIView的动画只能动画一套固定的UIView属性:
@property frame
@property bounds
@property center
@property transform
@property alpha
@property backgroundColor
@property contentStretch
要解决缺乏的UIImageView完成块的,你可以参考这里的答案:
iPhone : Best way to detect the end of UIImageView image sequence animation
有什么其他方式来动画图像? – halloway4b 2012-08-07 20:05:49