How to add a tab bar item to a UITabBarController without a view controller?

In my iPad app, I have a UITabBarController at the bottom with a bunch of view controllers associated with a bunch of tabs. I would like to have a tab that shows a popup when touched. I know how to use the UIPopoverController, but I don’t know how to add a tab to the UITabBarController without giving the controller the tab bar UIViewController.

Any suggestions on how to do this?

Thanks.

Here is the code that should popup. ( Source )

CGFloat tabBarHeight = self.tabBarController.tabBar.bounds.size.height; CGRect rect = CGRectMake(0, 0, tabBarHeight, tabBarHeight); [popoverController presentPopoverFromRect:rect inView:self.tabBarController.tabBar permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; 
+6
source share
1 answer

If you really want to do this (this is a rather non-standard user interface ...), then you can add an empty view controller, but in your delegate tab, do

 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController 

And return NO for this view controller (so it won't be selected), but show your popover instead.

+7
source

Source: https://habr.com/ru/post/895786/


All Articles