Swift 创建新用户后文本字段中重新出现的文本
//好的,我需要在按下注销按钮后立即清除文本字段。“inputToolbar”是我在MessagesViewController中使用的变量,但注销按钮在另一个屏幕上Swift 创建新用户后文本字段中重新出现的文本,swift,Swift,//好的,我需要在按下注销按钮后立即清除文本字段。“inputToolbar”是我在MessagesViewController中使用的变量,但注销按钮在另一个屏幕上 @IBAction func logoutUser(sender: AnyObject) { let installation = PFInstallation.currentInstallation() installation.setObject("", forKey: "user") installa
@IBAction func logoutUser(sender: AnyObject) {
let installation = PFInstallation.currentInstallation()
installation.setObject("", forKey: "user")
installation.saveInBackground()
PFUser.logOut()
MessagesViewController.inputToolbar.contentView.textView.resignFirstResponder()
//Segue to Splash Screen
self.navigationController?.popToRootViewControllerAnimated(true)
}
与:
你是在弃用键盘,这在此时是看不到的
要清除文本视图,需要使用以下命令重置其文本属性:
MessagesViewController.inputToolbar.contentView.textView.text = ""
MessagesViewController.inputToolbar.contentView.textView.text = ""