Swift 动态创建提示框

var alert = UIAlertController(title: "", message: "", prefferedStyle: UIAlertControllerStyle.Alert)

 

//添加按钮

let oneAction = UIAlertAction(title: "", style: UIAlertActionStyle.Default) {(action: UIAlertAction)->Void in

//取文本框内容

 let textField = alert.textField[0] as TextField 

}

alert.addAction(oneAction )

 

//添加文本框

alert.addTextFieldWithConfigurationHandle{(textField: UITextField)->Void in

}

 

//显示弹出框

self.presentViewController(alert, animated: true){()->Void in

}

你可能感兴趣的:(swift)