swift animateWithDuration在iOS 7中不起作用
我有一个在iOS 8.1中运行正常的animation,但在iOS 7.1中,button只出现在没有animation的地方。
该button的前导,尾部和底部约束为0,高度约束为80.约束条件在故事板中设置。
在viewWillAppear方法中,我将底部约束更改为-80,以便在开始时不会看到。
当用户按下一个button,button应该动起来,我运行这个方法:
func animateCtaUp() { self.ctaView.layoutIfNeeded() UIView.animateWithDuration(0.5, delay: 0, options: .CurveEaseOut, animations: { self.ctaViewBottomConstraint.constant = 0 self.ctaView.layoutIfNeeded() }, completion: { finished in }) }
基本上有2个错误。
第一个是:我有一个没有布局限制的视图。 当我添加他们的一个animation开始运行。
第二个错误是:我在打电话
self.ctaView.layoutIfNeeded()
相反,我应该打电话
self.view.layoutIfNeeded
- 当有很多使用阴影的UILabels运行的UIViewanimation时,设备会冻结,然后按Homebutton
- UIView animateWithDuration在iOS 8中performance有所不同
- animationDidStop方法的多个CAAnimations?
- 无限旋转UIView,直到调用停止方法,并将视图animation回到起始点
- 在animation之前改进HTML5 Canvas逐帧JPGanimation来完全caching
- UICollectionView布局更改的默认animation持续时间是多less?
- CAShapeLayer上的CABasicAnimation不能用于path更改
- ARC是否与Core Graphics对象一起工作?
- 在Swift中animationMapKit注释坐标变化?