关于ios登录的那点事

#pragmamark - TextFieldDelegate

-(BOOL)textFieldShouldBeginEditing:(UITextField*)textField{

if(textField ==_usernameTextField) {

_passwordTextField.text=@"";

}

returnYES;

}

如果密码的field不为空,点击账号时会将密码置为空,根据实际情况,看是否需要这样做

- (BOOL)textFieldShouldReturn:(UITextField*)textField

{

if(textField ==_usernameTextField) {

[_usernameTextFieldresignFirstResponder];

[_passwordTextFieldbecomeFirstResponder];

}elseif(textField ==_passwordTextField) {

[_passwordTextFieldresignFirstResponder];

[selfdoLogin:nil];

}

returnYES;

}

点击return,如果是账号field...如果是密码field,提高用户体验

你可能感兴趣的:(关于ios登录的那点事)