【发布时间】:2011-10-19 16:41:31
【问题描述】:
您好,我有一个问题,
在我的AppDelegate 中,我使用了beginGeneratingDeviceOrientationNotifications 方法在设备开始旋转时开始通知我。
如果我手持 ipad,它可以正常工作,但是当它放在桌子上时,它不能按预期工作。
它会触发UIDeviceOrientationUnknown 通知。
此通知也会在 UI 启动后启动,而不是在初始屏幕上。
以下是我的代码:
if([[[PulseUIFactory Factory] GetUICreator] IsIPad])
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
}
current device stars giving proper values.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
然后是我启动 UI 的地方
[self Launch_UI];
但通知在[self Launch_UI]; 调用后开始响应,即使通知在其调用之前已注册...
请提供任何帮助!!!
【问题讨论】: