【问题标题】:Is it possible to remove the 'Edit' and '+' buttons on an iOS Master-Detail View?是否可以删除 iOS 主从视图上的“编辑”和“+”按钮?
【发布时间】:2012-11-30 08:37:21
【问题描述】:

目前,我的 iOS (6) 应用程序使用 Master-Detail 视图模板,并预先填充了一些列表元素。用户当前可以选择“编辑”并添加到(“+”)列表。有没有办法删除这些按钮,以防止更改原始列表?

【问题讨论】:

标签: iphone ios xcode ipad ios6


【解决方案1】:

是的,有一个简单的方法。

MasterViewController.m 中找到此代码并删除这些行self.navigationItem.leftBarButtonItem = self.editButtonItem;self.navigationItem.rightBarButtonItem = addButton;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.navigationItem.leftBarButtonItem = self.editButtonItem;

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
    self.navigationItem.rightBarButtonItem = addButton;
}

【讨论】:

  • 谢谢!这正是我一直在寻找的。抱歉,我还没有足够的代表来投票给你的答案。
  • 哈哈没关系。快乐编码:)
猜你喜欢
  • 2014-07-30
  • 1970-01-01
  • 2018-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多