1
我使用通知来获取设备的方向。屏幕旋转锁定时如何获取设备方向?
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[notificationCenter addObserver:self
selector:@selector(deviceOrientationDidChange)
name:UIDeviceOrientationDidChangeNotification
object:nil];
但是当设备的屏幕旋转被锁定时不会调用选择器功能。任何帮助?
是否正确设置了“notificationCenter”?检查它是否不是零。您也可以尝试以下语法:[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange)name:UIDeviceOrientationDidChangeNotification object:nil]; – rdurand