這個問題的上下文是iOS 8,僅適用於橫向模式的Xamarin和PlayN。如何使用iOS 8 SDK重新調整PlayN應用程序?
我曾經根據UIScreen.MainScreen.Bounds
對FinishedLaunching
中的應用進行了重新調整,以適應不同的屏幕尺寸。使用iOS 8 SDK時,API的語義發生了變化。以前,UIScreen
不取決於方向。這裏以前的SDK,用來做工精細代碼:
public partial class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
app.SetStatusBarStyle (UIStatusBarStyle.LightContent, false);
IOSPlatform.Config config = new IOSPlatform.Config();
config.orients = IOSPlatform.SupportedOrients.LANDSCAPES;
IOSPlatform.register (app, config);
System.Drawing.RectangleF bounds = UIScreen.MainScreen.Bounds;
// Flip width and height when in landscape for iOS SDK before iOS 8
float screenHeight = bounds.Width;
float screenWidth = bounds.Height;
float heightRatio = screenHeight/MyGame.HEIGHT;
float widthRatio = screenWidth/MyGame.WIDTH;
float ratio = (heightRatio < widthRatio ? heightRatio : widthRatio);
PlayN.graphics().rootLayer().setScale (ratio, ratio);
MyGame game = new MyGame();
PlayN.run (game);
return true;
}
}
與iOS 8 SDK,UIScreen
現面向接口。我認爲只是刪除翻轉高度和寬度的代碼將足以遷移。但這種情況並非如此。用戶界面向右移動大約三分之一的屏幕並失真。
上下文:
- 的Xcode 6的β6個
- Xamarin.iOS 7.9.4.29
- 1.8.5
任何意見遷移這個代碼將不勝感激。
任何解決方案?我遇到了同樣的問題!蘋果爲什麼不讓這些工作繼續下去?每個版本都會導致我的噩夢... 謝謝, Rick – Rick 2014-10-28 17:45:47
我在谷歌開發者論壇上問過。 PlayN開發人員承認他們有一個嚴重的問題:[看到這裏](https://groups.google.com/forum/#!topic/playn/rAmw43lVGak)從那以後,我正在等待補丁。 – fredstroup 2014-10-30 08:28:40