I create a custom right view as follows:
// Build the Segmented Control
NSArray *segmentTextContent = [NSArray arrayWithObjects:[UIImage imageNamed:@"arrow-dice.png"], [UIImage imageNamed:@"arrow-up.png"], [UIImage imageNamed:@"arrow-down.png"], nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
// Customize the Segmented Control
segmentedControl.momentary = YES;
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
[segmentedControl addTarget:self action:@selector(segmentChanged:) forControlEvents:UIControlEventValueChanged];
Then I add it to my navigation bar as follows:
// Add the control to the navigation bar right item
UIBarButtonItem *segmentItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
[segmentedControl release];
self.navigationItem.rightBarButtonItem = segmentItem;
self.navigationItem.rightBarButtonItem.title = @"";
[segmentItem release];
I can hide it as follows:
self.navigationItem.rightBarButtonItem.customView.hidden = NO;
QUESTION ...but how can I disable all (or better, a specific element) of the segmented control?
The following does not work.
self.navigationItem.rightBarButtonItem.enabled = NO;
Any ideas appreciated...
Thanks,
matt