I am using xcdYoutubeVideoViewController which is subclassed from MPMoviePlayerController. My application is in portrait. To launch the movieplayer, I am doing this:
UINavigationController *navBarController = (UINavigationController*)[[[UIApplication sharedApplication] keyWindow] rootViewController] ;
[navBarController presentMoviePlayerViewControllerAnimated:vc];
where vc is instance of XCDYouTubeVideoPlayerViewController. How can I allow rotation only in this view and on pressing done button in movieplayer bring the application back to portrait?
You should override:
-(BOOL) shouldAutorotate
in each view controller. Return YES if you want that view controller to rotate NO otherwise. Be sure to check the supported orientation on your storyboard setting.Update: In your parent controller that presents the player try this:
If the app root controller is a Navigation Controller, subclass
UINavigationViewController
and use that class in creating the app root view controller in App Delegate