【发布时间】:2014-04-29 09:37:25
【问题描述】:
我正在尝试使用标志 UIViewAnimationOptionRepeat 链接一组 UIView animateWithDuration:
我试图重复的动画步骤是:
- 为
UIView向左设置 100 像素的动画 - 淡出
UIView(不透明度'0') - 淡出(不可见)时,将其移回原始位置(向右 100 像素)
- 将
UIView淡入(将不透明度设置为'1') - 使用标志
UIViewAnimationOptionRepeat重复动画
我无法重复整个动画链 - 并且只能重复最顶部的动画。
我试过的代码是这样的:
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat animations:^{
self.handImageView.frame = CGRectMoveByXPixels(self.handImageView.frame, -100);
[UIView animateWithDuration:0.5 delay:1 options:0 animations:^{
self.handImageView.alpha = 0;
} completion:^(BOOL finished) {
self.handImageView.frame = CGRectMoveByXPixels(self.handImageView.frame, 100);
[UIView animateWithDuration:0.5 delay:0 options:0 animations:^{
self.handImageView.alpha = 1;
} completion:^(BOOL finished) {
}];
}];
} completion:^(BOOL finished) {
}];
【问题讨论】:
标签: ios objective-c uiview uiviewanimation