Wednesday 15 November 2017

AlertDialog with Textfield








*****

let alertController = UIAlertController(title: "Your Title", message: "Your Subtitle here", preferredStyle: UIAlertControllerStyle.alert)
        
        alertController.addTextField(configurationHandler: nil)
        
        let OKAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default) { (action) -> Void in
            
        }
        
        alertController.addAction(OKAction)

        present(alertController, animated: true, completion: nil)

******

       // IF DATA NULL, CALL YOUR METHOD


//        let OKAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default) { (action) -> Void in
//            let textfield = alertController.textFields![0]
//            if textfield.text?.characters.count == 0 {
//
//              //  self.askForNickname()
//            }
//            else {
//

//            }

No comments:

Post a Comment