1

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.

NDY
  • 3,527
  • 4
  • 48
  • 63
  • Provide all the versions information of your system. You can get them from "MonoDevelop" menu, "About MonoDevelop" item, "Version Information" tab. Click on the "Copy Version Information" button and edit/paste it into your question. – poupou Jan 17 '13 at 13:31

3 Answers3

2

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.

poupou
  • 43,413
  • 6
  • 77
  • 174
  • Thanks for your help. Its strange because I have the SDK for 6.0. But I guess something is really wrong - im installing everything new and will try again. Probably that will solve my problems. I will give u feedback. – NDY Jan 17 '13 at 15:00
  • Problem solved. Now I can select 6.0 in MonoDevelop and the landscape only mode works 2. – NDY Jan 17 '13 at 15:16
1

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

svn
  • 1,235
  • 10
  • 22
1

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.

Davut Gürbüz
  • 5,526
  • 4
  • 47
  • 83