func inputMsg() { var points = "" var outOf = "" var alertController = UIAlertController(Title: "input VIEw",message: "Please input Your Grade",preferredStyle: UIAlertControllerStyle.Alert) let actionCancle = UIAlertAction(Title: "Cancle",style: UIAlertActionStyle.Cancel) { ACTION in println("Cacle") } let actioninput = UIAlertAction(Title: "input",style: UIAlertActionStyle.Default) { ACTION in println("input") println(points) println(outOf) } alertController.addAction(actionCancle) alertController.addAction(actioninput) alertController.addTextFIElDWithConfigurationHandler({(txtFIEld: UITextFIEld!) in txtFIEld.placeholder = "I got" txtFIEld.keyboardType = UIKeyboardType.NumberPad points = txtFIEld.text }) alertController.addTextFIElDWithConfigurationHandler({(txtFIEld: UITextFIEld!) in txtFIEld.placeholder = "Out Of" txtFIEld.keyboardType = UIKeyboardType.NumberPad outOf = txtFIEld.text }) presentVIEwController(alertController,animated: true,completion: nil)}解决方法 UIAlertController有一个textFIElds属性.这是它的文本字段.您的任何处理程序都可以检查它,从而可以从任何文本字段中获取文本. 总结
以上是内存溢出为你收集整理的xcode – Swift UIAlertController获取文本字段文本全部内容,希望文章能够帮你解决xcode – Swift UIAlertController获取文本字段文本所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)