Frage

I want to have as a minimum the iOS6 in my app. I tried to create a tabbar application with the sample project provided by Mono. I tried to delete the ShouldAutorotateToInterfaceOrientation method and replaced it by

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
{
    return UIInterfaceOrientationMask.Landscape;
}

I did it for both ViewController, but the orientation is still Portrait. I also tried to override ShouldAutorotate and returned true, but did not help also. What do I have to do that my app is only in landscape mode available?

I also tried to set the deployment target to iOS6, but I can only switch up to 5.1 in the drop down list.

Any suggestions?

EDIT: Something with my installation was totally wrong. Because I could not select ios6 as deployment target, nothing worked. After a new clean installation everything works.

War es hilfreich?

Lösung

Like @svn said the Info.plist states which orientations your application support. This can be further customized (e.g. restricted) by overriding GetSupportedInterfaceOrientations.

But there's also (new in iOS 6) PreferredInterfaceOrientationForPresentation which can (and should be) overridden.

More details, including iOS6 specific features, are available in Apple documentation.

I also tried to set the deployment target to iOS6, but I can only switch up to 5.1 in the drop down list.

That sounds like the Xcode you're using does not have the 6.0 SDK. See my comment on your question on how you can check what's being used by MonoDevelop to build your application.

Andere Tipps

You should also set the supported device orientations in Info.plist

For iOS 5 and iOS 6 support you should do that, Sadly "GetSupportedInterfaceOrientations" has problems ,at least for my modal !

//iOS 6 support
    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
    {
        return base.GetSupportedInterfaceOrientations ();
    }

    //iOS 5 support
    //if I don't put it it doesn't work for iOS 5 device but works on iOS 6 simulator
    [Obsolete ("Deprecated in iOS6. Replace it with both GetSupportedInterfaceOrientations and PreferredInterfaceOrientationForPresentation")]
    public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
    {
        return true;
    }

sure project properties for allowance first.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top