I'm adding multiple buttons to the navigation bar like so.
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 133, 44.01)];
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];
UIBarButtonItem *bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(assignSelected)];
bi.style = UIBarButtonItemStyleBordered;
[bi setEnabled:FALSE];
[buttons addObject:bi];
[buttons addObject:self.editButtonItem];
[tools setItems:buttons animated:NO];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
self.editButtonItem.title = @"Select";
Essentially I'm doing this so they can use the edit button to select a group of items and take action on them. I want to enable to action button I added in there when they are editing. I have the following method to control what the buttons say when editing.
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
if (editing)
{
self.editButtonItem.title = NSLocalizedString(@"Cancel", @"Cancel");
}
else
{
self.editButtonItem.title = NSLocalizedString(@"Select", @"Select");
}
}
That is where I want to enable and disable the action button. I'm not sure though how to access the button since it was created programmatically.
You should be able to access it via the "bi" variable that you created it with. The bi variable should hold the pointer to the button. So you can call methods on that button like so:
[bi methodName:methodArg];