Wymuś kontrolery, aby zmienić ich orientację w trybie Portret lub Krajobraz
Mam następujące kontrolery (wybrałem wszystkie tryby orientacji typów na iPadzie)
Oto mój układ iPad Storyboard
Custom NavigationController > Loading Ctrl > Main Controller.
My Custom Navigation Zawiera
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
W moim kontrolerze ładowania
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
SupportInterfaceOrientations jest wywoływana jak zwykle i wszystko wydaje się w porządku, ale kiedy pchnę mój Główny Kontroler używając performSegue
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
Nie więcej połączeń w MainController. Dlaczego?