【发布时间】:2016-09-27 04:16:32
【问题描述】:
我以前也遇到过这个问题,但不知道是什么问题。
如果我在 Playground 中为“独立”视图设置动画,这种情况看起来不错,但现在看起来就像在提供的 GIF 中一样。
动画看起来不错,但是当我想对其进行动画处理(缩放)时,它只会变得最大尺寸然后消失。
下面是动画代码:
self.circleView.transform = CGAffineTransformIdentity
UIView.animateWithDuration(0.5, delay: 0, options: [], animations: {
self.circleView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
}, completion: {
finished in
if finished {
self.resetStyle()
self.circleView.hidden = true
self.circleView.transform = CGAffineTransformIdentity
}
})
func resetStyle() {
self.circleView.transform = CGAffineTransformIdentity
self.circleView.backgroundColor = nil
self.textLabel.textColor = UIColor.blackColor()
}
【问题讨论】:
-
self.resetStyle()在做什么? -
我将其添加到问题中
-
您是否尝试过将此动画应用到视图层而不是直接应用到
UIView?并用 3D 变换替换仿射变换?
标签: ios animation uiview core-animation