开发者

MPMoviePlayerViewController not rotating in landscape with tabbar

I display a video using MPMoviePlayerViewController in a tabbar application, the video plays fine in portrait mode but doesn't rotate in landscape mode.

The same code works fine in another project without the tabbar.

I tried to force the autoresizingmask to flexibleWidth and flexibleHeight without success.

If i return YES in the shouldAutorotateToInterfaceOrientation the status bar rotates but not the movie interface.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}

    -(IBAction) showFamilleMovie {
     NSString *videoURL = [[NSBundle mainBundle] 
            pathForResource:@"film1" 
            ofType:@"mp4"];

     MPMoviePlayerViewController* theMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoURL]];
        th开发者_JAVA技巧eMoviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self presentMoviePlayerViewControllerAnimated:theMoviePlayer];

    }

Do you have any idea where the project could come from ?

Thanks, Vincent


you can try:

 [yourTabbarController presentModalViewController: theMoviePlayer]

that should allow MoviePlayer to rotate.


I had the same problem and the code killer for that was a view added in my appDelegate code. It didn't let the player to rotate properly.

My problem was: To implement the FBConnect library, you need to add a view in your appDelegate to get the object for the FB controller class that you're using the handleOpenURL method (back from Safari when auth is done) and control the callback. I spent an hour until I realized that this view was blocking the rotation.

BTW, don't care about the tab bar. The player should rotate correctly even if you don't have the shouldAutorotateToInterfaceOrientation method added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜