我正在使用 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/