views:

96

answers:

2

I have a view controller that's been added to a UITabBarController. In this view controller I have a button that opens up a movie using MPMoviePlayerViewController.

When I play the movie, the top navigation bar is still overlayed on top of the movie, effectively blocking out a portion of the screen.

When this view controller isn't inside a UITabBarController, however, the movie plays fine.

Anyone know what's going on?

A: 

Figured it out. I guess things get wonky because MPMoviePlayerViewController has a method added as a category to UIViewController called presentMoviePlayerViewControllerAnimated:. Normally you would call it like this in your UIViewController:

[self presentMoviePlayerViewControllerAnimated:mp];

But in this case, if you've added your view controller to a UITabBarController stack, self is your view controller within the tab bar controller, and I guess this makes things screwy. The fix is to call presentMoviePlayerViewControllerAnimated: with the parent view controller, which in my case, was another UIViewController that was housing UITabBarController. I simply referenced the parent view and added it to my view controller's init method, then called something like [parentController presentMoviePlayerViewControllerAnimated:mp].

Whew. Hope that helps someone.

Calvin L
A: 

I am facing same problem - can you post some sample code please? Thanks for your help

I am facing problem with MPMoviePlayerController (I have not done the ViewController)

Does anyone know a solution for the Controller ?

Shailesh
Hi, can you please post a new question? After you do so, reply back here and I will help you if I can.
Calvin L