forked from xxhp/NGTabBarController
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Is there a way to add tabs during runtime? With UITabBarController, I can do something like this
NSArray *existingTabs = self.tabBarController.viewControllers;
NSMutableArray *mut = [[NSMutableArray alloc] initWithArray:existingTabs];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:[NSBundle mainBundle]];
self.extraViewController = [[ExtraViewController alloc] init];
self.extraViewController = [storyboard instantiateViewControllerWithIdentifier:@"ExtraViewController"];
[mut addObject:self.extraViewController];
[self.tabBarController setViewControllers:mut animated:YES];
However, I can't get this working with NGTabBarController, when I change the last line above to :
[self.tabBarController setViewControllers:mut]; // no animated
.. I get this exception:
-[NSNull addTarget:action:forControlEvents:]: unrecognized selector sent to instance
.. on this line in NGTabTabController, within the method setTabBarItems
[item addTarget:self action:@selector(handleItemPressed:) forControlEvents:UIControlEventTouchDown];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels