Bug*_*aya 5 iphone cocoa-touch cell uitableview ios
我确实将此代码添加到我的viewDidLoad
,编辑按钮显示,但行的左侧没有减号按钮.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
Run Code Online (Sandbox Code Playgroud)
滑动行后,显示删除按钮,但是当我点击编辑按钮时没有减号.
什么可能导致减号不会出现在我的程序中?
将表格视图编辑模式设置为,
[self.tableView setEditing:YES animated:YES];
Run Code Online (Sandbox Code Playgroud)
在导航栏中的编辑按钮的操作方法中执行上述操作.
或者只是使用,
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.tableView setEditing:editing animated:animated];
}
Run Code Online (Sandbox Code Playgroud)
如果要显示删除按钮,可以实现以下代码.
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
return UITableViewCellEditingStyleDelete;
}
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请查看Apple文档
归档时间: |
|
查看次数: |
1886 次 |
最近记录: |