【发布时间】:2015-01-31 07:58:14
【问题描述】:
我已经使用 UIView 动画创建了一个动画块 - 但是对于玩家键入的每个字母,动画都会在 UITextView 上触发(这是一个打字游戏)。输入新字母的那一刻,它会立即完成前一个角色的动画——不可能有重叠。如何在不中断每个动画的情况下允许多个动画开始和结束?
当前动画块:
UIView.transitionWithView(textViewForPlayer, duration: 0.1, options: .BeginFromCurrentState | .TransitionCrossDissolve | .AllowAnimatedContent, animations: {
self.textForPlayer.addAttribute(
NSForegroundColorAttributeName,
value: UIColor.clearColor(),
range: nsRangeOfTextShown)
self.textViewForPlayer.attributedText = self.textForPlayer
}, completion: { finished in
UIView.transitionWithView(self.textViewForPlayer, duration: 2.1, options: .BeginFromCurrentState | .TransitionCrossDissolve | .AllowAnimatedContent, animations: {
self.textForPlayer.addAttribute(
NSForegroundColorAttributeName,
value: UIColor.greenColor(),
range: nsRangeOfTextShown)
self.textViewForPlayer.attributedText = self.textForPlayer
}, completion: { finished in
})
println("FINISHED2")
}
)
【问题讨论】:
标签: ios swift uiviewanimation