如何在 iOS 中为一组图像制作动画
我有一组图像,我想要 UIImageView 对其进行动画处理,
我知道如何使用此方法执行此操作:
[myImageView setAnimationImages:myImageArray];
[myImageView setAnimationDuration:.7];
[myImageView setAnimationRepeatCount:1];
[myImageView startAnimating];
但是我想使用不同的方法。我想这样做
[UIView animateWithDuration:.7 delay:0 options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
// animate image array
}
completion:^(BOOL finished){
// [self animationEnded];
}
];
,但我不确定在我拥有的 // 动画图像数组中放置什么
I have an array of images that I want a UIImageView to animate
I know how to do this with this method:
[myImageView setAnimationImages:myImageArray];
[myImageView setAnimationDuration:.7];
[myImageView setAnimationRepeatCount:1];
[myImageView startAnimating];
However I want to use a different method. I want to do this
[UIView animateWithDuration:.7 delay:0 options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
// animate image array
}
completion:^(BOOL finished){
// [self animationEnded];
}
];
but I am not sure what to put where I have // animate image array
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许 [UIView setAnimationDelegate:self] 会对你有帮助?
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];然后将执行你的animationDidStop::。
或者,如果您尝试坚持使用块,我认为这将是一系列嵌套的动画完整部分,例如
Maybe [UIView setAnimationDelegate:self] will help you?
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; will perform your animationDidStop:: then.
Or, if you are trying to stick with blocks, I think it would be a series of nested animations-complete sections like