我使用主从模板在界面构建器中创建了一个项目,我想摆脱编辑按钮。
我写(在 MasterViewController 中):
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return NO;
}
这会禁用编辑按钮,但该按钮仍然存在。
然后我尝试了(在 viewDidLoad 中,将 tableView 属性连接到我的 MasterViewController 类之后):
[self.tableView setEditing:NO];
但是,按钮仍然存在。