ios - 浏览每个位于连续 tableView 单元格内的文本字段?

标签 ios

我正在使用 tableView Controller ,其中有 4 个部分。第一部分包含 2 个文本字段,第二部分有 4 个文本字段,第三部分有 7 个,依此类推。我面临的问题是我无法通过按键盘上的下一个和上一个按钮来浏览文本字段。实际上,我已经尝试了很多开源库来将“下一步”和“上一个”按钮放在键盘上方的工具栏上,但无法这样做。每次加载键盘时,其上方都没有工具栏。

可能是由于 tableview 单元格内的文本字段。 谁能建议我这样做的解决方案。

最佳答案

尝试:

UIToolbar* toolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
toolbar.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *barItem = [[UIBarButtonItem alloc]initWithTitle:@"Previous" style:UIBarButtonItemStyleDone target:self action:@selector(prev)]
toolbar.items = [NSArray arrayWithObjects:[[UIBarButtonItem alloc]initWithTitle:@"Next" style:UIBarButtonItemStyleDone target:self action:@selector(nextTF)],barItem,nil];
[toolbar sizeToFit];
self.yourTextField.inputAccessoryView = toolbar;

下一步:

-(void)prev
{
    //previous
}

-(void)nextTF
{
    //next
}

关于ios - 浏览每个位于连续 tableView 单元格内的文本字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19161446/

相关文章:

jquery - 如何在 Kendo Ui Mobile 中将数据绑定(bind)到 Dropdownlist

ios - PFUser 查询需要时间从 Parse 获取用户

ios - 为搜索栏委托(delegate)赋值 - Swift

iphone - UITableView 背景作为平铺图像

ios - 为什么我需要 'import ' 框架'?

ios - Objective-C 查找方法的调用者

ios - 如何创建在每日和每周基准的时间线 View 中显示日历事件的应用程序?

ios - 如何在 SwiftUI 中基于绑定(bind)枚举更改 View 的样式?

iphone - 在后台线程中运行操作并有一个完成 block ?

ios - 在 NSURLSessionData 的实现中未调用委托(delegate)方法