How to add a TextField to UIAlertView in Swift

前端 未结 10 1069
耶瑟儿~
耶瑟儿~ 2020-12-23 13:41

I have this code, but I dont know how to show a textfield inside the UIAlertView.

var altMessage = UIAlertController(title: \"Warning\", message: \"This is A         


        
10条回答
  •  旧时难觅i
    2020-12-23 14:30

    I see you're already using the new UIAlertController -- good idea, since there's little use in old API if you're usung Swift anyway. But alert.textFieldAtIndex: won't work for that; it's for UIAlertView only.

    Luckily, UIAlertController has a method for adding text fields.

提交回复
热议问题