Orientation 在iOS5模式下,VIewController中无法使用方向通知

Orientation 在iOS5模式下,VIewController中无法使用方向通知,orientation,ios5,modalviewcontroller,Orientation,Ios5,Modalviewcontroller,请原谅我的英语…) 在my viewController(A)中,有一个方向通知程序,如下所示: - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation]; if (newOrientation == UIDevic

请原谅我的英语…)

在my viewController(A)中,有一个方向通知程序,如下所示:

 - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{ UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];

if (newOrientation == UIDeviceOrientationUnknown || newOrientation == UIDeviceOrientationFaceUp || newOrientation == UIDeviceOrientationFaceDown) {
    UIInterfaceOrientation mainOrientation = [[UIApplication sharedApplication] statusBarOrientation];
    newOrientation = (UIDeviceOrientation) mainOrientation;
}
当这是控制器时,它工作正常

有时会出现一个ModalViewController(B),它可以被重新定向到新的方向,并做到完美。但是,当取消此模式时,主视图控制器将保持与以前相同的方向

通过断点控制,我检查了上述方法中的代码是否没有被执行

在我实现IOS5 SDK之前,所有这些都工作得非常好

(由于CGPLOT问题,我没有重构到ARC)。 有谁能帮助我,或者遇到过同样的问题

显而易见的解决方案是从模态视图调用此方法。。。但这很烦人(


非常感谢您,祝您度过愉快的一天!

使用发送通知

[[NSNotificationCenter defaultCenter] postNotificationName:@"changeOrientation" object:nil];
从didRotate…工作的视图和在其他类中使用的视图:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doWork) name:@"changeOrientation" object:nil];
为了赶上这一事件

Лааааааааааааааа