2

How can I enable/disable navigationItem.rightBarButton item? I am calling the following code at -viewDidLoad but it does nothing.

self.navigationItem.rightBarButtonItem = 
      [[[UIBarButtonItem alloc]
            initWithTitle:@"Flow"
            style:UIBarButtonItemStyleDone
            target:self  action:@selector(flowWithMe:)] autorelease];

self.navigationItem.rightBarButtonItem.enabled = NO;

I want to enable right Bar Button only on a particular action.

0

2 Answers 2

2

You can set the rightBarButtonItem to nil until the point where you need to enable it.

2

I found the problem, i was reenabling the button on - (void)textFieldDidBeginEditing:(UITextField *)textField

and this was the only text field on the view and on ViewDidLoad this was becoming the first responder so after ViewDidLoad, this function was getting called and right bar button was re-enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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