UIDeviceOrientationDidChangeNotification 多次调用,加速度计发生微小变化
我用来
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
更改我的应用程序委托中的某些视图。
但这是在加速度计的微小变化中被调用的。任何人都可以建议任何解决方法,以便仅在设备完全旋转时才调用它。 谢谢
I am using
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
to make changes to some views in my appdelegate.
But this gets called in a slightest variation of the accelerometer. Can anyone suggest any workaround, so that it gets only called when the device is completely rotated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能否在发布通知之前编写一些代码来检查设备的宽度 = 480 和高度 = 320(这是设备旋转 90 度时的情况)?
所以像这样:
Could you write some code to check the device's width = 480 and height = 320 (this is when the device has been rotated 90 degrees) before posting the notification?
So something like:
在视图控制器中重写此方法。当设备旋转到新方向时它将被调用
override this method in your view controller. It will get called when the device has rotated to a new orientation