1

I use UINavigationController for my view controller. In init() or viewDidLoad(), i set :

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
   initWithBarButtonSystemItem:UIBarButtonSystemItemEdit 
   target:self action:@selector(selector)];

While present or push view, right bar button (and left if have) is disabled. But if I replace by custom button then it's worked normally.

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
   initWithImage:image title:nil 
   target:self action:@selector(selector)];

I think this is root cause of my other question here :
MFMailComposeViewController navigation bar buttons are disabled

Does anyone has ideas? Thanks in advance!

Community
  • 1
  • 1
anhduongt
  • 1,119
  • 2
  • 12
  • 17

1 Answers1

0

The proper way to enable the edit button item is:

self.navigationItem.rightBarButtonItem = self.editButtonItem;

Does this also occur with other UIBarButtonItemSystemItems ?

Mundi
  • 79,884
  • 17
  • 117
  • 140