0
사용하려는 확장 프로그램에 대한 약간의 도움이 필요합니다. 예를 들어, statusLabel.text에 잘못된 비밀번호를 입력 한 경우와 같이 statusLabel.text를 통해 오류를 제공하는 로그인 페이지가 필요합니다.IOS textFieldDidBeginEditing
을 "잘못된 리스팅 다시 시도하십시오"가 표시 할 것은 이것은 내가 바을 되돌릴 상태 라벨을 원하는
extension LoginViewController: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
return true
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldDidEndEditing(_ textField: UITextField) {
textField.resignFirstResponder()
}
func textFieldDidBeginEditing(_ textField: UITextField) {
statusLabel.text = ""
}
}
내 로그온 섹션
@IBAction func login(_ sender: Any) {
self.userName.resignFirstResponder()
self.password.resignFirstResponder()
self.repeatPassword.resignFirstResponder()
self.passwordsStack.resignFirstResponder()
self.progress.startAnimating()
switch self.currentLoginType {
case .login:
let email = self.userName.text
let password = self.password.text
FirebaseManager.login(email: email!, password: password!, completion: { (status: Bool, error: Error?) in
if status && error == nil {
if FirebaseManager.isEmailVerified {
self.dismiss(animated: true, completion: nil)
print (error?.localizedDescription ?? "")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let LoginVC = storyboard.instantiateViewController(withIdentifier: "ReavealVC") as! SWRevealViewController
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController = LoginVC
} else {
DispatchQueue.main.async {
self.statusLabel.text = "Your email is not verified. Please check your email"
self.progress.stopAnimating()
print ("have we stopped at email not verified")
self.clearLoginTextFields()
}
}
} else {
DispatchQueue.main.async {
self.progress.stopAnimating()
self.statusLabel.text = FirebaseManager.StringFromError(error: error)
print("have we stopped at email after its not verified")
self.clearLoginTextFields()
}
}
})
case .signup:
if self.password.text == self.repeatPassword.text{
let email = self.userName.text
let password = self.password.text
FirebaseManager.LinkWithEmailAndPassword(email: email!, password: password!, completion: { (status: Bool, error: Error?) in
if status && error == nil {
self.dismiss(animated: true, completion: nil)
self.progress.stopAnimating()
self.statusLabel.text = "Email verification sent, please check you inbox"
print(error?.localizedDescription ?? "")
} else {
DispatchQueue.main.async {
self.progress.stopAnimating()
self.statusLabel.text = FirebaseManager.StringFromError(error: error)
}
}
})
self.view.endEditing(true)
clearLoginTextFields()
}else{
self.progress.stopAnimating()
self.statusLabel.text = "Passwords do not match, please try again!"
}
case .forgotPassword:
FirebaseManager.sendPasswordReset(email: self.userName.text!, completion: { (status:Bool) in
DispatchQueue.main.async {
self.progress.stopAnimating()
self.statusLabel.text = status ? "Reset password sent" : "Error sending reset password"
}
})
break
}
}
그리고 내 확장 ck to ""사용자가 자격 증명을 다시 입력하기 시작했지만 내 textFieldDidBeginEditing이 호출되지 않는 것 같습니다.