Why do you need TWO ViewControllers just for the purpose of Orientation ..?
HEre Simple scenario ,
Create 2 Views
- Portrait &&
- Landscape View , As per your requirement .
Follow something like this .
-(BOOL)shouldAutorotate{
return YES;
}
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self orientationChanged:toInterfaceOrientation];
}
-(void)orientationChanged:(UIInterfaceOrientation)orientation{
NSLog(@"orientation change");
// UIDeviceOrientation deviceOrientation = [[object object] orientation];
if(orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown){
NSLog(@"Changed Orientation To Portrait");
self.viewPortrait.hidden = NO;
self.viewLandscape.hidden = YES;
}
else if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight){
NSLog(@"Changed Orientation To Landscape");
self.viewPortrait.hidden = YES;
self.viewLandscape.hidden = NO;
}
}
And You should set for which all orientation required .
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}