Alert with Textfield / Alerta con Textfield

let alert = UIAlertController(title: "Title", message: "My Mesage", preferredStyle: .Alert) let cancelAction = UIAlertAction(title: "Cancel", style: .Default, handler: nil) let saveAction = UIAlertAction(title: "Add", style: .Default, handler: { (action) -> Void in let textField = alert.textFields!.first self.palabrasTabla.append(textField!.text!) self.tableView.reloadData() }) alert.addTextFieldWithConfigurationHandler { (textField) -> Void in } alert.addAction(saveAction) alert.addAction(cancelAction) //If present xcode bug with log //alerta.view.setNeedsLayout() presentViewController(alert, animated: true, completion: nil)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.