简体   繁体   中英

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. My code is as follows:

public class NotebookSelectionController : UIViewController {

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

My app delegate code is as follows:

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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