小编Tay*_*ith的帖子

为什么UIAlertController中的选项变暗,如何解决?

这是一个奇怪的。我用下面的代码制作UIAlertController:

let optionMenu = UIAlertController(title: nil, message: "Choose Option", preferredStyle: UIAlertControllerStyle.ActionSheet)

    let action = UIAlertAction(title: "Action 1", style: .Default, handler: {
        (alert: UIAlertAction!) -> Void in
        print("Cancelled")
    })

    let action2 = UIAlertAction(title: "Action 2", style: .Default, handler: {
        (alert: UIAlertAction!) -> Void in
        print("Cancelled")
    })

    let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
        (alert: UIAlertAction!) -> Void in
        print("Cancelled")
    })

    optionMenu.addAction(cancelAction)
    optionMenu.addAction(action)
    optionMenu.addAction(action2)

    self.presentViewController(optionMenu, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

这就是屏​​幕上的样子。选项是暗淡的(我相信后视图会受到其影响)。

调光的选项

我能够添加此代码以使其成为纯白色,但是分离的好处消失了。

let subview = optionMenu.view.subviews.first! as UIView
let alertContentView …
Run Code Online (Sandbox Code Playgroud)

ios swift uialertcontroller

5
推荐指数
1
解决办法
761
查看次数

标签 统计

ios ×1

swift ×1

uialertcontroller ×1