在我的项目中,我只允许肖像旋转,但对于一个ViewController
我想启用景观。我将这个ViewController
表示为ModalViewController
,我尝试过使用方法- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
或iOS 6方法,如-(NSUInteger) supportedInterfaceOrientations
,但没有任何实际工作。虽然这些方法被调用,但视图并不旋转。只允许一个视图控制器自动旋转
在此之后,我试图通过myslef与聆听这些通知将它旋转:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
,但即使我能够在方法didRotate
手动旋转view
:这是非常乱,我可以” t旋转StatusBar
。
我真的很喜欢使用标准方法,如shouldAutorotateToInterfaceOrientation
,但我不知道如何。任何人?
设置故事板中该特定视图控制器的方向是什么? – SangamAngre
如果您将属性检查器中的方向设置设置为继承。我不能设置肖像或只是风景,我想这两个支持。 –
什么是为您的项目设置的支持方向? – SangamAngre