выглядит, как вы хотите, чтобы заставить ориентацию только ландшафтный режим ..
Heres мое решения в MyViewController.h
добавить этот код на вершине @interface MyViewController в
//force orientation on device
@interface UIDevice (PrivateOrientation)
- (void) setOrientation:(UIInterfaceOrientation)orientation;
@end
затем в файле реализации (MyViewController.m) добавить этот код внутри viewWillAppear:
//change orientation of device
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
это заставит ориентацию устройства для Landscap Режим е влево (или вправо, в зависимости от того, что вы хотите)
, если вы хотите, чтобы вернуться в портретный режим после выхода из ViewController добавить этот код внутри viewWillDisappear:
//change orientation of device
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
наконец реализовать shouldAutorotateToInterfaceOrientation: чтобы заставить представление в ландшафтном режиме влево или вправо (или оба)
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
надеюсь, что это помогает: 3
ли мое приложение будет отвергнуто из App Store для этого? – DGund
Я думаю, вы можете найти эту тему полезной [здесь] (http://stackoverflow.com/questions/5030315/how-to-constrain-autorotation-to-a-single-orientation-for-some-views-while-allo) и [здесь] (http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation) Я не могу сказать, что его 100% приемлемо, основываясь на том, что они упомянули [здесь] (http://stackoverflow.com/questions/7280464/device-orientation-change-in-legal-way-ios-4-0) > Невозможно принудительно настроить ориентацию устройства и получить свое приложение одобренный Apple. – otakuProgrammer
Мне нужно его одобрить Apple, но спасибо. Я приму свой ответ. – DGund