AXTableKeyboardChain 0.1.0

AXTableKeyboardChain 0.1.0

测试测试过
语言语言 Obj-CObjective C
许可证 MIT
发布日期上次发布2014年12月

Hiroki Akiyama (akiroom)akiroom 维护。




通过 C 函数在 UITableViewCell 中实现的超级简单的 UITextField / UITextView 链。您只需使用 AXTableKeyboardChainGetNextField()AXTableKeyboardChainGoToNext()

Screenshot

使用方法

要运行示例项目,克隆仓库,然后首先从 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 文件。