3

I would like to make a toolbar (or possibly just a view) appear above the tab bar in all tabs, like in the Spotify app. Ideally, this would be the same toolbar/view accessible by all tabs, so if it changes in one place, I don't have to change it for every tab. Another thing is that each tab has its own navigation controller, so this causes a problem as each navigation controller generally has its own toolbar. Maybe something in the tab bar view controller to add a view above it? I haven't found much on this topic, so I'm not sure what to do, any ideas? It should look like this (note the tab bar and toolbar/view at the bottom):

screenshot
(source: mzstatic.com)

Thanks!

Community
  • 1
  • 1
rohinb
  • 408
  • 2
  • 4
  • 15

1 Answers1

2

I faced far too many problems with making this a UIToolbar, and instead created a custom view (through XIB called StatusView) and added it to the UITabBarController's view as a subview with the following code in my custom UITabBarController subclass:

NSArray *arr = [[NSBundle mainBundle] loadNibNamed:@"StatusView" owner:self options:nil];
self.statusView = [arr objectAtIndex:0];
self.statusView.frame = CGRectMake(0, screenHeight - (TabBarHeight + StatusBarHeight), screenWidth, StatusBarHeight);
[self.view addSubview:self.statusView];
rohinb
  • 408
  • 2
  • 4
  • 15
  • 1
    This doesn't account for the offset of the `StatusView`. The `-[UITabBarController selectedViewController]` will expand to the `tabBar.frame.origin.y`, causing your content to be hidden below your custom view. – pxpgraphics Dec 01 '16 at 18:23