Search code examples
iosuinavigationcontrolleruitabbarcontrolleruitabbaruitoolbar

Making custom toolbar appear over tab bar in all tabs like Spotify app - iOS


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!


Solution

  • 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];