IPad View not rotating

Question!

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??



Answers

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.



This video can help you solving your question :)
By: admin