【问题标题】:Xcode Swift: is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1Xcode Swift:被要求为其不透明度设置动画。这将导致效果出现损坏,直到不透明度恢复为 1
【发布时间】:2018-02-18 14:09:00
【问题描述】:

每次我单击左侧视图控制器上的注册按钮时。我收到这个警告说:

"2017-09-10 11:14:50.573574+0800 Custom Fonts[1413:62959] [警告] 被要求为其不透明度设置动画。这将导致效果出现损坏,直到不透明度返回1."

我检查了视觉效果的 alpha 设置,它们都设置为 1。我该如何解决这个问题?

我的代码:

import UIKit

class SignUpVC: UIViewController {
    @IBAction func dismissPopUp(_ sender: UIButton) {
        dismiss(animated: true, completion: nil)
    }

    @IBAction func signUp(_ sender: UIButton) {
        //signup logic
         dismiss(animated: true, completion: nil)
    }
}

【问题讨论】:

标签: ios swift warnings


【解决方案1】:

将动画改为“假”,

dismiss(animated: false, completion: nil)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-24
    • 2020-07-03
    • 2014-07-07
    • 2012-03-05
    • 2015-12-01
    • 2010-09-25
    • 2011-08-05
    相关资源
    最近更新 更多