點選鍵盤的next按鈕,在不同的textField之間換行

weixin_33850890發表於2017-03-23
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    if ([textField returnKeyType] != UIReturnKeyDone) {
        NSInteger nextTag = [textField tag] + 1;
        UIView *nextTextField = [self.tableView viewWithTag:nextTag];
        [nextTextField becomeFirstResponder];
    }else {
        [textField resignFirstResponder];
    }
    
    return YES;
}

相關文章