I have 2 view controllers: ViewControllerA and ViewCotrollerB.
ViewControllerA only support Landscape Left/Right.
These are some methods in ViewControllerA.m:
- (BOOL)shouldAutorotate{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeRight;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[self settingLayoutForOrient:[[UIApplication sharedApplication] statusBarOrientation]];
}
ViewControllerB is displayed when call follow code in ViewControllerA:
ViewControllerB *control = [[ViewControllerB alloc] init];
[self presentViewController:control animated:NO completion:nil];
ViewControllerB support full orientations.
These are some methods in ViewControllerB.m:
- (BOOL)shouldAutorotate{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation{
[self settingLayoutForOrient:[[UIApplication sharedApplication] statusBarOrientation]];
}
Please help me answer questions in below:
- From ViewControllerA and device in Portrait mode, go to ViewControllerB. Why at the first time ViewControllerB apprear, orientation of status always is Landscape left/right and althought device is in portrait mode?
2.How to get exacly orient of status bar in every case (portrait, portraitUpsideDown, FaceUp, FaceDown, landscape left, landscape right) in ViewControllerB at the first time ViewControllerB appear?
Thanks for your help.