记一次错误使用 UIView Animation 引起的崩溃
上周做新版本的新手引导需求的时候,写了下面一段代码 @objc func nextStep() { // 点击事件 if currentStepIndex < viewChain.count { viewChain[currentStepIndex].clickBlock?() } // 隐藏当前步骤,展示下一个步骤 if currentStepIndex + 1 < viewChain.count { // 过渡动画,问题就出现在这里 UIView.animate(withDuration: 0.5) { self.viewChain[self.currentStepIndex].isHidden = true } completion: { finished in if finished { self.viewChain[self.currentStepIndex + 1].isHidden = false self.currentStepIndex += 1