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

}

posted on 2015-01-22 23:54  大木哥  阅读(297)  评论(0编辑  收藏  举报

导航