Good morning, I'm trying to hide a UITabBarItem and after read lots of posts here, I'm getting crazy....I can get the tabItem properly, but it doesn't hides. I setup my TabBar in Storyboard.
Here is my code..none of the 3 options I tried works...
Any helps will be appreciated
@implementation unidaAppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
self.tabBarController = [storyboard instantiateViewControllerWithIdentifier:@"myTab"];
NSMutableArray *tabs = [NSMutableArray arrayWithArray:self.tabBarController.viewControllers];
NSLog(@"Array:%@",tabs);
/*
OPTION 1
NSMutableArray *viewControllersCopy = [[self.tabBarController viewControllers] mutableCopy];
[viewControllersCopy removeObjectAtIndex:2];
NSArray *modifiedViewControllers = [[NSArray alloc] initWithArray:viewControllersCopy];
[self.tabBarController setViewControllers:modifiedViewControllers animated:NO];
OPTION 2
NSMutableArray *modifyMe = [[self.tabBarController.tabBar items] mutableCopy];
[modifyMe removeObjectAtIndex:2];
NSArray *newItems = [[NSArray alloc] initWithArray:modifyMe];
[self.tabBarController.tabBar setItems:newItems animated:true];
OPTION 3
NSLog(@"TabBarItem: %@",[[self.tabBarController.tabBar.items objectAtIndex:2] title]);
[[self.tabBarController.tabBar.items objectAtIndex:2] setEnabled:FALSE];
*/
sleep(1);
return YES;
}