<分区>
我有一个由 Parse 支持的登录页面。我想知道如何仅在通过 Parse 数据库确认登录后才创建 segue,然后将用户定向到新的 View Controller。
这是登录按钮的代码:
@IBAction func logginginAction(sender: AnyObject) {
var username = self.usernameField.text
var password = self.passwordField.text
if (count(username.utf16) < 4 || count(password.utf16) < 5 ) {
var alert = UIAlertView(title: "Invalid", message: "Username/Password is too short!!", delegate: self, cancelButtonTitle: "OK")
alert.show()
}
else {
self.actInd.startAnimating()
PFUser.logInWithUsernameInBackground(username, password: password, block: { (user, error) ->
Void in
self.actInd.stopAnimating()
if ((user) != nil) {
}else {
var alert = UIAlertView(title: "Invalid", message: "Please recheck the information you just entered", delegate: self, cancelButtonTitle: "OK")
alert.show()
}
})
}
}