ViewController没有响应didRotateFromInterfaceOrientation [英] ViewController not responding to didRotateFromInterfaceOrientation
本文介绍了ViewController没有响应didRotateFromInterfaceOrientation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的视图控制器没有响应 didRotateFromInterfaceOrientation
,尽管我在代码中添加了以下内容:
My view controller is not responding to didRotateFromInterfaceOrientation
, despite that I have added following in my code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[self.popOver dismissPopoverAnimated:NO];
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
... My Custom Code...
}
}
我在这里做错了吗?
推荐答案
如果你能'从UIViewController继承(这是不幸的),您可以使用 this :
If you can't inherit from UIViewController (which is unfortunate), you can use this:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
然后注册以开始接收 UIDeviceOrientationDidChangeNotification
通知。
Then register to start receiving UIDeviceOrientationDidChangeNotification
notifications.
这篇关于ViewController没有响应didRotateFromInterfaceOrientation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文