What's a simple way to get a text input popup dialog box on an iPhone

后端 未结 12 2054
-上瘾入骨i
-上瘾入骨i 2020-12-02 03:42

I want to get the user name. A simple text input dialog box. Any simple way to do this?

12条回答
  •  -上瘾入骨i
    2020-12-02 04:34

    Building on John Riselvato's answer, to retrieve the string back from the UIAlertView...

    alert.addAction(UIAlertAction(title: "Submit", style: UIAlertAction.Style.default) { (action : UIAlertAction) in
                guard let message = alert.textFields?.first?.text else {
                    return
                }
                // Text Field Response Handling Here
            })
    

提交回复
热议问题