BillF
BillF

Reputation: 444

MonoTouch SupportedInterfaceOrientations not found

In MonoTouch 6.0.10 with SDK 6.1 I have the following in a tabbarcontroller and navigationcontroller:

public override bool ShouldAutorotate()
{
    return true;
}

public override UIInterfaceOrientationMask SupportedInterfaceOrientations()
{
    var orientations = ParentViewController.GetSupportedInterfaceOrientations();
    foreach ( var controller in ViewControllers )
        orientations = orientations & controller.GetSupportedInterfaceOrientations();
    return orientations;
}

In AppDelegate I have:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations (UIApplication application, UIWindow forWindow)
{
    return UIInterfaceOrientationMask.All;
}

and in FinishedLaunching I have:

window.RootViewController = tabController;

In the tabbarcontroller and navigationcontroller this gets an error of the form 'HelloWorld.TabController.SupportedInterfaceOrientations() is marked as an override but no suitable method found to override (CS0115).'

Any suggestion appreciated!

Bill.

Upvotes: 1

Views: 765

Answers (1)

poupou
poupou

Reputation: 43553

UIViewController defines GetSupportedInterfaceOrientations which you can override in your UITabBarController and UINavigationController subclasses.

The C# compiler error message (and your code) shows that you're missing the Get prefix.

Upvotes: 2

Related Questions