iPad方向 [英] iPad Orientations
问题描述
这里是app的结构:
在委托中,我将rootViewController作为子视图添加到窗口:
in delegate, i add rootViewController as subview to the window:
RootViewController *rootView = [[RootViewController alloc] init];
[window addSubview:rootView.view];
在rootViewController中,我有一个以编程方式设置的接口(像弹跳板这样的按钮的早午餐),并且目前仅在肖像模式下工作。
In rootViewController there is an inteface I crate programmatically (a brunch of buttons like the springboard), and is currently working only in portrait mode.
当我添加:
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"we are here");
return YES;
}
没有任何反应,只是在app运行,而不是在我改变方向时。
nothing happens, its called just when the app runs, and not when I change orientations.
那么我想念的是什么?
如何让我的View控制器根据方向旋转?
So what I miss ? How I will make my View controller rotate based on orientation?
感谢您的帮助。
推荐答案
您应该正确配置 Info.plist
检查 UISupportedInterfaceOrientations~ipad (支持的界面方向(iPad))阵列,如果没有添加此节点以及您希望在您的应用中支持的方向。
Check if the UISupportedInterfaceOrientations~ipad (Supported interface orientations (iPad)) array is present, if not add this node and the orientations you want to be supported in your app.
这篇关于iPad方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!