TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Hiroki Akiyama (akiroom), akiroom.
Super easy UITextField / UITextView chain in UITableViewCell by C-functions.
You need to use only AXTableKeyboardChainGetNextField()
and AXTableKeyboardChainGoToNext()
.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Example codes.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Acceptable any text field cell
AXTextFieldCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AXTextFieldCell" forIndexPath:indexPath];
[cell.textField setDelegate:self];
return cell;
}
}
#pragma mark - Text field delegate
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
// will be called when Keyboard will be shown.
// ***THIS IS THE POINT***
if (AXTableKeyboardChainGetNextField(self.tableView, textField)) {
[textField setReturnKeyType:UIReturnKeyNext];
} else {
[textField setReturnKeyType:UIReturnKeyDefault];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// will be called when return key is pressed.
// ***THIS IS THE POINT***
AXTableKeyboardChainGoToNext(self.tableView, textField);
return YES;
}
Hiroki Akiyama, [email protected]
AXTableKeyboardChain is available under the MIT license. See the LICENSE file for more info.