我的iPhone应用程序目前都处于纵向模式.
但我需要在宽屏模式下播放视频,并绘制一些在纵向模式下效果最佳的ui元素.此外,屏幕上有时会输入一些文字输入,因此键盘也需要显示为肖像.
是否有可能告诉UIViewController何时加载它需要转到Landscape,堆栈上的父视图将是Portrait.
我不想检测用户旋转,我想决定哪些屏幕将是风景,哪些将是肖像.
所以回顾一下,我的应用程序上的everyscreen / view将是肖像,除了我想制作Landscape的那个.可以吗?
非常感谢,
-码
解决方法
在你的UIViewController中,你实现了这个方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations BOOL result = NO; if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { result = YES; } return result; }
并且您为要支持的方向返回YES.
加载时,此方法将在您的UIViewController上调用,因此每次进入UIViewController时都不会调用它.
如果你想绝对确定所有其他UIViewController都是你想要的方向,那么也要在它们中实现这个方法.