ios - UIAlertViewController 短暂闪烁/闪烁

标签 ios

我正在使用这个 swift 代码从 UIViewController

显示一个警告对话框
import UIKit

class TestViewController: UIViewController {
    @IBAction func onTestClick(sender: UIButton) {
        let alertController = UIAlertController(title: "title", message: "message", preferredStyle: .Alert)
        alertController.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))

        self.presentViewController(alertController, animated: true, completion: nil)
    }
}

当从具有深色(例如黑色)背景的 View 中显示警报时,它会短暂地“闪烁”(显示为白色,然后立即变为比白色稍暗的颜色)。

这似乎不会发生在其他应用程序和系统操作系统上。

这里有什么问题?

最佳答案

我能够重现您所说的内容,而且我认为您实际上并没有做错什么。如果您在模拟器 (cmd + t) 上打开慢速动画,您将看到警报 Controller 以渐变动画的形式位于屏幕中央。当动画进行时,警报 Controller 有一个白色背景(这是 Apple 的代码,很好),当动画结束时,警报 Controller 有一个透明背景,它会根据它后面的 View 的颜色而改变。当 View 是白色时你不会注意到任何东西,因为白色 + 白色 = 白色! :)

希望对您有所帮助。

关于ios - UIAlertViewController 短暂闪烁/闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34915166/

相关文章:

iphone - iphone 设备之间的蓝牙信号强度

ios - dismissViewControllerAnimated 导致相同的 View Controller 再次加载

ios - 如何在 iOS 中使用 Swift 正确检索加速度计数据?

ios - Scenekit - 我如何拖放

ios - Dailymotion 播放器无法在 UIWebview Swift 3 中工作

ios - IBOutlet 和其他的弱或强

ios - iOS 11 中的 SearchController。无法触摸任何 tableView 单元格

ios - ipad safari 等浏览器应用程序中的新标签栏功能

ios - 如何将每个用户链接到他们在 Firebase for Swift 3 中的数据?

ios - 如何将 "redundant tiles"放入 MBTiles sqlite 磁贴 View ?