【发布时间】:2011-11-26 11:17:27
【问题描述】:
在mViewController.xib.cs 类中,我需要及时确定任何实例的屏幕高度/宽度。所以我覆盖了以下内容。我让调试器进入这些方法,奇怪的是,无论 iPad 在哪个旋转,它都显示我的高度是 1024,宽度是 768,而实际上它应该交换取决于 iPad 的方向(纵向或风景)。有人可以告诉我我做错了什么吗?
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
RectangleF screeninfo = UIScreen.MainScreen.Bounds;
float height = screeninfo.Height;
float width = screeninfo.Width;
return true;
}
public override void DidRotate( UIInterfaceOrientation fromInterfaceOrientation)
{
RectangleF screeninfo = UIScreen.MainScreen.Bounds;
float height = screeninfo.Height;
float width = screeninfo.Width;
}
【问题讨论】:
-
iPad 使用objective-c buddy,而不是c#
-
伙计,有时候你没有一个奇怪的选择。你认为如果我有一个选择,我会使用objective-c。你认为我喜欢在没有文档、没有帮助、只有你一个人的环境中工作。但是看,我需要这份工作,它可以支付账单。
-
Monotouch 在 c# Haoest 中。