0

我有两个 TextFiels。首先,我在键盘上设置了“下一步”按钮,但“完成”按钮正在第二个字段上工作。我写了这段代码。

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == self.loginField) {
    [theTextField resignFirstResponder];
} else if (theTextField == self.passField) {
    [self.passField becomeFirstResponder];
}
return YES;
}

也许我做错了什么。

4

1 回答 1

0
    -(BOOL)textFieldShouldReturn:(UITextField *)textField
    {
        if(textField == self.loginField)
        {
            [self.passField becomeFirstResponder];
        }
        else if(textField == self.passField)
        {
            [textField resignFirstResponder];
        }
        return YES;
    }

In xib, select LoginField - Return key set as "Next", Select PassField - Return key as "Done"/"Next".
于 2013-07-10T10:13:57.477 回答