相关疑难解决方法(0)

从UIAlertController访问输入

我有一个UIAlertController,当他们在TouchID屏幕上选择"输入密码"时会提示用户.如何在屏幕上显示后恢复用户的输入?

let passwordPrompt = UIAlertController(title: "Enter Password", message: "You have selected to enter your passwod.", preferredStyle: UIAlertControllerStyle.Alert)
passwordPrompt.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: nil))
passwordPrompt.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))

passwordPrompt.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
                        textField.placeholder = "Password"
                        textField.secureTextEntry = true
                        })

presentViewController(passwordPrompt, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

我知道OK按钮可能应该有一个处理程序,但是现在这段代码并没有真正做任何事情,但我想通过println显示文本字段的输出.这对我来说真的只是一个测试应用程序,可以学习Swift和一些新的API.

swift ios8 uialertcontroller

48
推荐指数
4
解决办法
3万
查看次数

标签 统计

ios8 ×1

swift ×1

uialertcontroller ×1