gpt4 book ai didi

ios - UIAlertController 在最新的 Xcode 中显示错误

转载 作者:行者123 更新时间:2023-11-29 01:04:22 24 4
gpt4 key购买 nike

我正在创建一个简单的警报,但它向我显示了此错误。

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func but (action:UIButton) {

let alertcontroller = UIAlertController(title: "Title", message: "message", preferredStyle: .Alert)

let alert = UIAlertAction(title: "Action titel", style: .Default, handler: nil)
alertcontroller.addAction(alert)
self.presentedViewController (alertcontroller, animated:true, completion: nil)

}

}

it's showing this error **strong text**

最佳答案

它必须是 presentViewController(...) 而不是 presentedViewController(...)

关于ios - UIAlertController 在最新的 Xcode 中显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36582188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com