我有一组图像,我希望 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];
}
];
但我不确定在我有//动画图像数组的地方放什么
最佳答案
也许 [UIView setAnimationDelegate:self] 能帮到你?
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];将执行您的 animationDidStop::然后。
或者,如果您尝试坚持使用 block ,我认为这将是一系列嵌套动画——完整的部分,例如
[UIView animateWithDuration:.7 delay:0 options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
// Show first image
}
completion:^(BOOL finished){
// Hide first image
[UIView animateWithDuration:.7 delay:0 options:(UIViewAnimationOptionAllowUserInteraction) animations:^{
// Show second image
}
completion:^{
// Hide second image
}
}
关于ios - 如何在 iOS 中为一组图像制作动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7867888/