3

Currently, my iOS (6) application uses the Master-Detail view template, with some list elements being pre-populated. Users currently have the option to 'Edit' and add to ('+') the list. Is there a way of removing these buttons, to prevent the original list being changed?

1

1 Answer 1

11

Yes there is an easy way.

Find this code in MasterViewController.m and remove these lines 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;
}
2
  • Thanks! This is just what I was looking for. Sorry I don't have enough rep to up vote your answer yet. Dec 12, 2012 at 16:05
  • Haha its fine. Happy Coding :) Dec 12, 2012 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.