[英]How to change duration of animated UIImage?
I want to change my animated UIImage
in UIImageView
duration
during runtime, but it's property is read-only and there are no methods like setDuration
. 我想在运行时在UIImageView
duration
内更改动画的UIImage
,但是它的属性是只读的,没有像setDuration
这样的方法。 Is it possible? 可能吗? In viewDidLoad
i call this 在viewDidLoad
我称之为
-(void)prepareImage
{
UIImage *image = [UIImage animatedImageNamed:@"image-" duration:1.0f];
UIImageView *imageView = [[UIImageView alloc] initWithImage:squirrelImage];
self.imageView=imageView; //property with UIImageView
}
Then on some event i do this 然后在某些情况下我这样做
-(UIImageView *)redrawedImage
{
UIImageView *newImageView = self.imageView;
//a lot of translations and scales
return newImageView;
}
and i want to put animation's duration change inside without resetting the whole animation. 我想在不重置整个动画的情况下放入动画的持续时间更改。
UIImage * toImage = [UIImage imageNamed:@"myname.png"];
[UIView transitionWithView:self.imageView
duration:5.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
self.imageView.image = toImage;
} completion:nil];
use this code may help your.... 使用此代码可能对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.