Доброе утро, я пытаюсь скрыть UITabBarItem и после прочтения множества постов здесь, я схожу с ума .... Я могу правильно получить tabItem, но он не скрывается.Я установил свой TabBar в раскадровке.
Вот мой код .. ни один из 3 опций, которые я пробовал, не работает ...
Любая помощь будет оценена
@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;
}