在 iOS5 中,模式下 VIewController 中的方向通知不起作用
请原谅我的英语..:)
在我的 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)。 任何人都可以帮助我,或者遇到过同样的问题吗?
明显的解决方案是从模态视图调用此方法...但这
很烦人..:( 非常感谢您,祝您有美好的一天!
Excuse my English.. :)
In my viewController (A) there is a orientation notifier like this:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{ UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
if (newOrientation == UIDeviceOrientationUnknown || newOrientation == UIDeviceOrientationFaceUp || newOrientation == UIDeviceOrientationFaceDown) {
UIInterfaceOrientation mainOrientation = [[UIApplication sharedApplication] statusBarOrientation];
newOrientation = (UIDeviceOrientation) mainOrientation;
}
This is working properly when this is the controller.
There is a ModalViewController (B) that sometimes appear, and this could be reoriented to new orientation, and do it perfect. BUT, when this modal is dismissed, the main view controller remains in the same orientation it was before.
Controlling by breakpoints I´ve checked that the code in the method above is not being executed.
All this has been working perfectly before I actualized IOS5 SDK.
(I´ve not refactoriced to ARC, because of CGPLOT issues).
Any one could help me, or has suffered same issue?
The obvious solution is to call this method from the modal view... but it´s annoying..:(
Thanks you very much and have a nice day!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发送通知,
使用来自 didRotate... 工作的视图
并在其他类中使用:捕获此事件。
Лайтбрингер с ЕГ-форума?
Send a notification using
from view where didRotate... worked and in other class use:
to catch this event.
Лайтбрингер с ЕГ-форума?