测试测试过 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布日期上次发布 | 2014年12月 |
由 Hiroki Akiyama (akiroom),akiroom 维护。
通过 C 函数在 UITableViewCell 中实现的超级简单的 UITextField / UITextView 链。您只需使用 AXTableKeyboardChainGetNextField()
和 AXTableKeyboardChainGoToNext()
。
要运行示例项目,克隆仓库,然后首先从 Example 目录运行 pod install
。
示例代码。
- (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 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。