【发布时间】:2018-03-29 06:29:42
【问题描述】:
我们有 UITableViewController,我们在其中提供表格编辑功能,如附加的屏幕截图。我们想要显示/隐藏栏按钮项目的底部工具栏。
我们使用下面的代码进行编辑。
[self.tableView setEditing:YES animated:false];
editButton.title = @"Cancel";
[self.navigationController setToolbarHidden:NO animated:YES];
在这段代码之后,我们得到了与给定图像类似的工具栏(两个工具栏)。如何去除白色工具栏?
谢谢
编辑:
我们在做 pushViewController 时遇到了这个问题:
TransactionsListViewController *callTransactionsListViewController=[[TransactionsListViewController alloc]initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:callTransactionsListViewController animated:YES];
在 presentViewController 中我们没有遇到上述问题:
TransactionsListViewController *callTransactionsListViewController=[[TransactionsListViewController alloc]initWithStyle:UITableViewStylePlain];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:callTransactionsListViewController];
[self presentViewController:navController animated:YES completion:nil];
在 ViewDidLoad 中
[self.tableView setAllowsMultipleSelectionDuringEditing:YES];
[self.tableView setAllowsMultipleSelection:YES];
点击按钮时编辑表格视图:
-(IBAction)btEdit:(id)sender{
if (self.tableView.editing)
{
[self.tableView setEditing:NO animated:false];
editButton.title = @"Edit";
[self.navigationController setToolbarHidden:YES animated:YES];
}
else{
[self.tableView setEditing:YES animated:false];
editButton.title = @"Cancel";
[self.navigationController setToolbarHidden:NO animated:YES];
} }
【问题讨论】:
标签: ios objective-c uitableview uitoolbar