я следующий код в моей основной функции ViewController viewDidLoadКак установить ориентацию второго UIWindow
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
nav = [[NavWithAutoRotateViewController alloc] initWithRootViewController:self];
[window addSubview:[nav view]];
[window makeKeyAndVisible];
[[self navigationController] setNavigationBarHidden:YES];
Мой Ipad приложение в настоящее время настроен для работы только в ландшафтном режиме, и я использую это новое окно чтобы показать документ quicklook и позволить навигационной панели предоставить кнопку «Назад» и сохранить параметры для документа. Основная проблема заключается в том, что новая ориентация UIWindow не соответствует моим основным приложениям UIWindow.
У меня есть пользовательский UINavigationController, называемый NavWithAutoRotateController, и вот код для этого контроллера.
-(id)init
{
if(self)
{
// _supportedInterfaceOrientatoin = UIInterfaceOrientationMaskLandscape;
// _orientation = UIInterfaceOrientationLandscapeLeft;
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeLeft;
}
// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskLandscape;
}
У меня такая же проблема, вам удалось ее решить? –