shouldAutorotateToInterfaceOrientation:从不打电话 [英] shouldAutorotateToInterfaceOrientation: never called
问题描述
我将受支持的界面方向设置为除了部署信息下的纵向颠倒以外的所有内容。
I set supported Interface Orientations to be all except Portrait upside down under Deployment Info.
我想覆盖shouldAutorotateToInterfaceOrientation:用于自定义行为。 (即根据条件支持格局)
I would like to override shouldAutorotateToInterfaceOrientation: for custom behaviour. (i.e support landscape as per condition)
由于约束(自定义视图转换),我只有一个viewcontroller
I only have one viewcontroller due to constraints(customized view transitions)
这就是我的appdelegate中的代码:
this is what the code in my appdelegate looks like:
self.viewController = [[MyController alloc]initWithNibName:nil bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
在myController.m中,我覆盖了shouldAutorotateToInterfaceOrientation:
and in myController.m, i override shouldAutorotateToInterfaceOrientation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
应用程序自动切换到所有方向但纵向颠倒并且回拨永远不会调用。我已经尝试了改变来自shouldAutorotateToInterfaceOrientation的回复:在运行时间没有成功的建议。为什么?
the application autorotates to all orientations but portrait upside down and the call back is never called. I have tried the suggestion at change return from shouldAutorotateToInterfaceOrientation: at runTime with no success. why?
在附注中,什么是在运行时更改轮换支持的最佳方法?
on a side note, what would be the best way to change rotation support at runtime?
更新:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
被调用。我尝试放入
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
没有成功:(
推荐答案
使用ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
在ios6上弃用
这篇关于shouldAutorotateToInterfaceOrientation:从不打电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!