iOS早期的屏幕大小是固定,游戏界面的位置通常采用绝对定位。为了保证迁移的顺利,只需要放大iOS的根视图即可解决iPhone尺寸变大的问题!方法如下:

//原游戏界面尺寸大小
float viewWidth=480f; float viewHeight=800f; 
CGRect rect_screen = UIApplication.SharedApplication.Windows[0].Screen.Bounds; 
CGSize size_screen = rect_screen.Size; 
float scale_screen = (float)UIApplication.SharedApplication.Windows[0].Screen.Scale; 
//获取iOS设备实际分辨率尺寸
float screenWidth = (float)((float)size_screen.Width * scale_screen);
float ScreenHeight = (float)((float)size_screen.Height * scale_screen); 
//计算需要放大的倍数X方向,y方向
float scaleXValue=screenWidth/viewWidth;
float scaleYValue=screenHeight/viewHeight; 
UIApplication.SharedApplication.Windows[0].RootViewController.View.Transform = CGAffineTransform.MakeScale(scaleXValue, scaleYValue);
//如果界面存在偏移,可用一下方法移动视图位置 
//UIApplication.SharedApplication.Windows[0].RootViewController.View.Frame = new CGRect(0 ,0, (int)screenWidth , (int)ScreenHeight);