abhimuralidharan
abhimuralidharan

Reputation: 5939

UINavigationBar missplaced when MPMoviePlayerController exits fullscreen (ios 8 issue)

In my app I am using MPMoviePlayerController to stream a video.The image of the navigationbar of the view before the player entering fullscreen and after when the player exits fullscreen are shown below.

before fullscreen

before

after fullscreen

after

the navigation bar is shifted up by 20 pixels.tried many things like setting the frame hiding and unhiding the frame etc.but no use.

HOw can I correct this? 1. Can I use uibarpositioningdelegate to correct this?If yes,How?

Please help,Thanks.

Upvotes: 1

Views: 181

Answers (1)

Rahul Mayani
Rahul Mayani

Reputation: 3831

Try this...

Hide the navigation bar when entering fullscreen and display it again on unhide...

-(void)viewDidLoad {

     [super viewDidLoad];     

     [[NSNotificationCenter defaultCenter] addObserver:self
     selector:@selector(mPExitFullScreen) 
    name:MPMoviePlayerWillExitFullscreenNotification 
    object:nil];

     [[NSNotificationCenter defaultCenter] addObserver:self    selector:@selector(mPEnterFullScreen) name:MPMoviePlayerDidEnterFullscreenNotification object:nil];

}

- (void) mPExitFullScreen{
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}

- (void)mPEnterFullScreen {
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

Upvotes: 1

Related Questions