简体   繁体   English

iPad视图不旋转

[英]IPad View not rotating

I have a very simple app so far, and it will not rotate the view. 到目前为止,我有一个非常简单的应用程序,它不会旋转视图。 ShouldAutorotateToInterfaceOrientation gets called when the application starts, but never again when I rotate. 在应用程序启动时会调用ShouldAutorotateToInterfaceOrientation ,但在旋转时不会再次调用。 My code is as follows: 我的代码如下:

public class NotebookSelectionController : UIViewController {

    public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) {
            return true;
     }
}

My app delegate code is as follows: 我的app委托代码如下:

public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
    var notebookController = new NotebookSelectionController();
    window.AddSubview(notebookController.View);

    window.MakeKeyAndVisible();

    return true;
}

What am I missing?? 我错过了什么?

Is it working in simulator? 它在模拟器中工作吗? When you open in simulator the menu Hardware / rotate left for example? 当您在模拟器中打开菜单硬件/向左旋转时,例如? If it works there - check that on the device you do not have the autorotate switched off by the iOS - using the switch or in the "multitasking" bar. 如果它在那里工作 - 检查设备上没有关闭iOS的自动旋转 - 使用开关或“多任务”栏。

Stupid mistake, happened to me lots of times :) 愚蠢的错误,发生在我很多次:)

Other than that, there is no reason why this should not work, this is getting called properly. 除此之外,没有理由不这样做,这是正确的调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM