Ios UITextfield输出到字符串
我不知道如何将textfield的输出转换成字符串,以便与parse password reset方法一起使用。这是我的密码:Ios UITextfield输出到字符串,ios,swift,parse-platform,xcode6.1,Ios,Swift,Parse Platform,Xcode6.1,我不知道如何将textfield的输出转换成字符串,以便与parse password reset方法一起使用。这是我的密码: @IBAction func resetPassword(sender: AnyObject) { var refreshAlert = UIAlertController(title: "Password Reset", message: "Enter Email To Reset Password", preferredStyle: UIAlertContr
@IBAction func resetPassword(sender: AnyObject)
{
var refreshAlert = UIAlertController(title: "Password Reset", message: "Enter Email To Reset Password", preferredStyle: UIAlertControllerStyle.Alert)
refreshAlert.addTextFieldWithConfigurationHandler { emailField -> Void in
//TextField configuration
emailField.textColor = UIColor.blueColor()
emailField.placeholder = "Email Address On File"
}
refreshAlert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { (action: UIAlertAction!) in
println("Handle Ok logic here")
PFUser.requestPasswordResetForEmailInBackground(" ", target: nil, selector: nil)
}))
refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .Default, handler: { (action: UIAlertAction!) in
println("Handle Cancel Logic here")
}))
presentViewController(refreshAlert, animated: true, completion: nil)
}
我需要它,所以当按下按钮时,他们输入的任何电子邮件都会使用密码重置方法发送到解析。任何帮助都将是伟大的 您可以使用UIAlertController
的属性
您可以通过两种方式实现这一点:
refreshAlert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { (action: UIAlertAction!) in
var textField = (refreshAlert.textFields as Array<UITextField>)[0]
PFUser.requestPasswordResetForEmailInBackground(textField.text, target: nil, selector: nil)
}))
refreshAlert.addAction(UIAlertAction(标题:“确定”,样式:。默认值,处理程序:{(操作:UIAlertAction!))
var textField=(refreshAlert.textFields作为数组)[0]
PFUser.requestPasswordResetForMailinBackground(textField.text,目标:nil,选择器:nil)
}))
我得到一个[任何对象]?没有一个名为“firstObject”的成员出错了,非常感谢!!!!这一次我的头撞到了墙上。