Search code examples
objective-cmpmovieplayercontrolleradbannerview

iAd Banner hidden under MPMoviePlayerController


I have a view where I show a MPMoviePlayerController with the following code:

MPMoviePlayerController *player  = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[player view] setFrame:self.view.bounds];
[self.view addSubview: [player view]];
[player play];

Then I show an iAd Banner using the delegates and it actually shows if I don't add the player. So the iAd Banner is under the player. I need it to be shown over the player view, it has to cover part of the played video.

Is that possible fellas?


Solution

  • First of all I got the position of the two views:

    NSInteger indexOfControl1 = [[self.view subviews] indexOfObject:banner];
    NSInteger indexOfControl2 = [[self.view subviews] indexOfObject:mediaPlayer.view];
    NSLog(@"Banner: %ld",(long)indexOfControl1);
    NSLog(@"Media Player: %ld",(long)indexOfControl2);
    

    and then I moved the banner above the last view with the following code:

    [self.view insertSubview:banner aboveSubview:mediaPlayer.view];
    

    Thank you anyway, hope it helps someone else.