How can I enable/disable navigationItem.rightBarButton
item? I am calling the following code at -viewDidLoad
but it does nothing.
self.navigationItem.rightBarButtonItem =
[[[UIBarButton开发者_如何学编程Item 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.
You can set the rightBarButtonItem to nil until the point where you need to enable it.
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.
精彩评论