1

我想在我的应用程序中至少有iOS6。我试图用Mono提供的示例项目创建一个tabbar应用程序。我试图删除ShouldAutorotateToInterfaceOrientation方法和Monotouch Only风景iOS6

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

我做了两个视图控制器取代了它,但方向还是人像。我也尝试覆盖ShouldAutorotate并返回true,但也没有帮助。我必须做什么,我的应用程序只能在横向模式下使用?

我也尝试将部署目标设置为iOS6,但我只能在下拉列表中切换至5.1。

有什么建议吗?

编辑: 我的装置的东西是完全错误的。因为我无法选择ios6作为部署目标,所以没有任何工作。新的干净安装后,一切正常。

+0

提供您系统的所有版本信息。您可以从“MonoDevelop”菜单,“关于MonoDevelop”项目,“版本信息”选项卡中获取它们。点击“复制版本信息”按钮并编辑/粘贴到你的问题。 – poupou

回答

2

像@svn说Info.plist状态,其方位您的应用程序的支持。这可以通过覆盖GetSupportedInterfaceOrientations进一步定制(例如限制)。

但也有(iOS 6中的新增功能)PreferredInterfaceOrientationForPresentation哪些可以(也应该)覆盖。

Apple documentation中提供了更多详细信息,包括iOS6特定功能。

我也尝试将部署目标设置为iOS6,但我只能在下拉列表中切换到5.1。

这听起来像你使用的Xcode没有6.0 SDK。看看我对你的问题的评论,关于如何检查MonoDevelop使用什么来构建你的应用程序。

+0

感谢您的帮助。它很奇怪,因为我有6.0的SDK。但我猜想有些事情是真的错了 - 即时安装新的东西,然后再试一次。可能这会解决我的问题。我会给你反馈。 – NDY

+0

问题解决了。现在我可以在MonoDevelop中选择6.0,并且仅限景观模式工作2。 – NDY

1

你也应该选择支持的设备取向中的Info.plist

+0

我也做到了。 – NDY

1

对于iOS 5和iOS 6的支持,你应该这样做, 可悲的是“GetSupportedInterfaceOrientations”有问题,至少对我的模态!

//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; 
    } 

确定项目属性为优先。