快速动画,持续时间不考虑持续时间

时间:2015-05-12 21:46:40

标签: ios swift

帧在0.2秒左右更新,而不是所需的量(0.5)。当我尝试5秒时它的速度仍然是0.2秒左右。

我做错了什么?

这是我的整个方法:

@IBAction func photoFullscreenButtonReleased(sender: AnyObject) {
    photoFullscreen = !photoFullscreen

    if photoFullscreen {
        contentHeightConstraint.constant = self.view.frame.height

        animateUpdateConstraints()

        UIView.animateWithDuration(5) {
            self.previewLayer!.frame = self.cameraView.bounds
        }
    }
    else {
        contentHeightConstraint.constant = contentHeight

        animateUpdateConstraints()

        UIHelper.delay(0.25, closure: { () -> () in
            UIView.animateWithDuration(0.5) {
                self.previewLayer!.frame = self.cameraView.bounds
            }
        })
    }
}

可能导致问题的潜在功能?

func animateUpdateConstraints() {
    UIView.animateWithDuration(0.5) {
        self.view.layoutIfNeeded()
    }
}

0 个答案:

没有答案