在我的项目中,我只允许纵向旋转,但对于一个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];
但即使我能够手动旋转viewin 方法didRotate:它非常混乱,我无法旋转StatusBar.
我真的很想使用标准方法shouldAutorotateToInterfaceOrientation,但我不知道如何。任何人?
