views:

196

answers:

2

I have a UINavigationalController of which I've set the titleView to a UISegmentedControl.

Later on, if I do something like.

[self.navigationItem.titleView setEnabled:NO forSegmentAtIndex:0];

I get a warning saying that UIView may not respond to this message. Of course it does and works fine but how do I properly get rid of the warning?

+1  A: 

Cast the titleView as a UISegmentedControl:

[(UISegmentedControl *)self.navigationItem.titleView 
                                           setEnabled:NO forSegmentAtIndex:0];
DyingCactus
+1  A: 

Similar to DyingCactus's suggestion:

UISegmentedControl * segments = self.navigationItem.titleView;
[segments setEnabled:NO forSegmentAtIndex:0];
Douglas