When using my app users can click and watch videos displayed in a list. Once they click on that video they can change the orientation to either portrait or landscape. The list page is only portrait.
The error I am facing is when the user watch's a video in landscape and exits the page in landscape my list page become all messed up.
I need a way to turn the orientation back to portrait every time the user presses done on the video and returns back to the list.
On the list page I do have
- (BOOL)shouldAutorotate{
return YES;
}
And I even tried to call shouldAutorotate
method in the viewDidAppear but that doesn't work. I know that shouldAutorotate
is not being called after the page is loaded so is there a way to check the orientation then flip it or just make it portrait no matter what?
I still need landscape so I am not going to remove it from my plist file.
Any help would be great. Thanks
EDIT
Here is how I call my video player
MPMoviePlayerViewController *player=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[[main_data objectAtIndex:indexPath.row] objectForKey:@"url"]]];
UIView * playerView = [player view];
[playerView setFrame: CGRectMake(0, 0, 480, 320)];
CGAffineTransform landscapeTransform;
landscapeTransform = CGAffineTransformMakeRotation(90*M_PI/180.0f);
landscapeTransform = CGAffineTransformTranslate(landscapeTransform, 80, 80);
[playerView setTransform: landscapeTransform];
[self presentMoviePlayerViewControllerAnimated:player];
return;