Question

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];
Was it helpful?

Solution

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top