在我的对象初始化方法中
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(didRotate:)
name:@"UIDeviceOrientationDidChangeNotification"
object:nil];
做旋转方法
- (void) didRotate:(NSNotification *)notification {
NSLog(@"rotate notification");
//MA_MobileAppDelegate *appDelegate = (MA_MobileAppDelegate *)[[UIApplication sharedApplication] delegate];
//UIInterfaceOrientation orientation = appDelegate.tabBarController.interfaceOrientation;
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
由于某种原因,didRotate 似乎在实际旋转之前被调用。因此,当我尝试获取当前/最终旋转时,我得到了最后一个。只有 1 个视图控制器似乎并非如此。任何想法我做错了什么?