1

I'm using MPMoviePlayerController in UITabbarcontroller and I don't know why it doesn't auto rotate

Here is my code:

NSURL *url = [NSURL URLWithString: [dt objectForKey:@"TrailerPath"]];

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

    moviePlayer.shouldAutoplay = YES;  
    moviePlayer.view.frame = [[UIScreen mainScreen] applicationFrame];
    moviePlayer.view.transform = CGAffineTransformMakeRotation(1.57079633);
    moviePlayer.view.bounds = CGRectMake(0.0, 0.0, 480, 320);        
[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlayBackDidFinish:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:moviePlayer];
[moviePlayer prepareToPlay];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
BlueSky
  • 139
  • 3
  • 9

1 Answers1

0

Did you setup supported interface orientations for your project, in project settings?

EDIT: You can set supported interface orientations here: enter image description here

Timur Mustafaev
  • 4,869
  • 9
  • 63
  • 109
  • I don't know what can i do, can you explain more detail for it? – BlueSky Jan 23 '13 at 08:29
  • right, i'm fix interface only portrait, when playing video need to lanscape – BlueSky Jan 23 '13 at 08:46
  • Ok, look at my question here: http://stackoverflow.com/questions/12526054/autorotate-in-ios-6-has-strange-behaviour/12538622 I had the same problem – Timur Mustafaev Jan 23 '13 at 08:57
  • Yes, see answer in that question – Timur Mustafaev Jan 23 '13 at 09:52
  • thank @Tim, can you help me once more time, check this link http://stackoverflow.com/questions/14475673/ios-login-view-before-uitabbarcontroller/14476067#14476067 – BlueSky Jan 23 '13 at 10:01
  • hi @time, i'm using code like - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } // pre-iOS 6 support - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation == UIInterfaceOrientationPortrait); }, but MPMoviePlayer still rotate – BlueSky Jan 27 '13 at 17:55