Swift: Insert Alert Box with Text Input (and Store Text Input )
问题 In one of my viewController , I want to make an alert box appear that prompts the user to type this information.Then, I want the user to store this input using NSUserDefaults . How can I achieve this? Thank you in advance! 回答1: Check this out: let alertController = UIAlertController(title: "Email?", message: "Please input your email:", preferredStyle: .alert) let confirmAction = UIAlertAction(title: "Confirm", style: .default) { (_) in guard let textFields = alertController.textFields,