I'm using Storyboards in xcode with iOS5. I have a TabBarController with 6 tabs. Prior to the TabController a user selects a type of account A oR B, if type B is selected I would like to hide one of the tabs.
I have a subclass of UITabBarController and this piece of code works but its not quite what I want.
if (accountType == 2) {
[[[[self tabBar] items] objectAtIndex:1] setEnabled:NO];
}
This makes my second tab dark and unusable which is ok, but I really wanted this to work...
[[[[self tabBar] items] objectAtIndex:1] setHidden:YES];
But it causes this error: -[UITabBarItem setHidden:]: unrecognized selector sent to instance 0x856f490 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarItem setHidden:]: unrecognized selector sent to instance 0x856f490'
Is there another way of achieving this?