---- 警报:菜鸟问题传入 ----
基本上我在 _textFields 中有一堆文本字段,我想这样做,当我按下按钮(下一个)时,当前文本字段退出第一响应者,并且数组中的下一个文本字段获得第一响应者。
现在我不知道如何访问 counter + 1 元素。
for (UITextField *counter in _textFields)
if ([counter isFirstResponder])
[*insert text here* becomeFirstResponder];
编辑:现在我想出了这种方式,但我觉得有一种更优雅的方式。
for (int i = 0 ; i < [_textFields count] - 1 ; ++i )
if ( [[_textFields objectAtIndex: i] isFirstResponder]) {
[[_textFields objectAtIndex: i+1 ] becomeFirstResponder];
break;
}