我想在运行时期间更改UIImage
UIImageView
中的动画duration
,但它的属性是只读的,并且没有像setDuration
这样的方法。可能吗?
在viewDidLoad
我称之为
-(void)prepareImage
{
UIImage *image = [UIImage animatedImageNamed:@"image-" duration:1.0f];
UIImageView *imageView = [[UIImageView alloc] initWithImage:squirrelImage];
self.imageView=imageView; //property with UIImageView
}
然后在某些事件上我这样做
-(UIImageView *)redrawedImage
{
UIImageView *newImageView = self.imageView;
//a lot of translations and scales
return newImageView;
}
我想在不重置整个动画的情况下将动画的持续时间更改到内部。
答案 0 :(得分:1)
UIImage * toImage = [UIImage imageNamed:@"myname.png"];
[UIView transitionWithView:self.imageView
duration:5.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
self.imageView.image = toImage;
} completion:nil];
使用此代码可能有助于您....