I have a parentViewController in potrait mode and I want to add childViewController(which is a subclass of MPMoviePlaycontroller) to it in a landscape mode this is the code I am using:
In ParentViewController.m
-(IBAction)playMovie
{
ChildViewController *childViewController = [[ChildViewController alloc] initWithContentURL:url];
[self.navigationController.view addSubview:childViewController.view];
childViewController.view.alpha = 0.0;
[childViewController beginAppearanceTransition:YES animated:YES];
[UIView
animateWithDuration:0.3
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^(void){
childViewController.view.alpha = 1.0;
}
completion:^(BOOL finished) {
[childViewController endAppearanceTransition];
[childViewController didMoveToParentViewController:self.navigationController];
}
];
}
In ChildViewController.m
-(BOOL)shouldAutorotate {
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
The problem is ChildViewController is still being displayed in portrait mode.