Моего требования это мой первый ViewController открыто в портретном режиме only.and, когда пользователь переходит на 2-й ViewController я хочу, чтобы контроллер в ландшафтном режиме, как могу я сделать этопервого ViewController в портретном и SecondViewController в ландшафтном режиме
я пытался этот код
первый ViewController.m
- (BOOL)shouldAutorotate
{
returnc YES;
}
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
{
return (interface==UIInterfaceOrientationMaskPortrait);
}
код для второго ViewController.m
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
//return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
это не будет работать для меня.
Что не работает? Опишите проблему, которую вы имеете. –
, когда пользователь переходит к второму дисплею контроллера в режиме protrait. Я хочу, чтобы он был в ландшафтном режиме. – Jitendra
Ответил на аналогичный вопрос, это может помочь. http://stackoverflow.com/questions/18185260/view-controllers-in-view-controller-and-orientation-ios/18185775#18185775 – BoranA