UITextField的returnKeyType有如下类型:
typedef NS_ENUM(NSInteger, UIReturnKeyType) {
UIReturnKeyDefault,
UIReturnKeyGo,
UIReturnKeyGoogle,
UIReturnKeyJoin,
UIReturnKeyNext,
UIReturnKeyRoute,
UIReturnKeySearch,
UIReturnKeySend,
UIReturnKeyYahoo,
UIReturnKeyDone,
UIReturnKeyEmergencyCall,
UIReturnKeyContinue NS_ENUM_AVAILABLE_IOS(9_0),
};
//要实现的Delegate方法,键盘next下跳
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if(textField.returnKeyType==UIReturnKeyNext){ //显示下一个
NSIndexPath *indexPath=((HHTextField *)textField).indexPath;
NSIndexPath *nextIndexPath=[NSIndexPath indexPathForRow:(indexPath.row+1)inSection:indexPath.section];
UITableViewCell *cell=[_personDataTableViewcellForRowAtIndexPath:nextIndexPath];
HHTextField *nextTextField=(HHTextField *)[cell viewWithTag:1162];
[nextTextField becomeFirstResponder];
}
return YES;
}
需要实现该方法来完成returnKey的功能。