Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Add constant View above Tabbar Issue

MatthewMMatthewM West London, UKPosts: 44New Users @
Hi all,

I have a Tabbar in which I need a view (media controller) to be placed above it, no matter which tab is being viewed.

I have successfully done this by creating a ViewController in Storyboard and then using the following code:
UIStoryboard *storyBoard = self.storyboard;
    MediaPlayerViewController* sample = [storyBoard instantiateViewControllerWithIdentifier:@"MediaPlayerSB"];
    UIView * playerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - self.tabBarController.tabBar.frame.size.height - 44, self.view.bounds.size.width, 44)];
    playerView.backgroundColor = [UIColor clearColor];
    sample.view.frame = [playerView bounds];
    [playerView addSubview:sample.view];
    [self.tabBarController.view addSubview:playerView];

The problem I have is that the class which is attached to the MediaPlayerViewController only ever fires ViewDidLoad! Nothing else works, no viewDidAppear etc..

I have also setup NotificationCentre listeners on this class and none of them work either.

Is there something else I need to do so that the class is active?

Thanks in advance!!!


  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,692Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    What function does playerView serve? Doesn't really seem necessary.

    In order to get the viewWill/Did/<Activity> methods to fire, the concept you need to research is View Controller Containment. Here's a starter link, feel free to search for newer articles.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | SlickShopper 2 | Leave a PayPal donation
  • MatthewMMatthewM West London, UKPosts: 44New Users @
    Hi Brian,

    Thanks for the reply.

    I think the easiest way to explain what I’m trying to achieve is to suggest looking at the Spotify app.

    The Spotify app has a tab bar, above it is where the play button and currently playing track is shown.

    That is exactly what I am trying to achieve. I thought I had cracked it by adding a view to the tab bar and then adding the player viewcontroller to that view.

    Just doesnt seem to work how I expected though.
Sign In or Register to comment.