AndyM
AndyM

Reputation: 1200

View Rotation in MonoTouch iPad Application

I'm pretty new to MonoTouch and I'm having problems getting my app to rotate from portrait to landscape mode.

My project has two XIB files, the MainWindow added by MonoTouch and MainController.xib which I have added. The MainController has a single label and no other controls. In my Main.cs I have the following to load the MainController.xib file:

UIViewController controller = new MainController();
window.AddSubview(controller.View);

In the MainController code I added

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

It all runs fine and the label displays but when I rotate the simulator nothing rotates. I'm sure it's something really simple that I'm getting wrong but I just can't seem to crack it.

Any help would be appreciated.

Upvotes: 0

Views: 753

Answers (1)

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

You can look at TweetStation for a sample.

In this particular case, you might want to return "true" instead of false in the sample above.

Upvotes: 2

Related Questions