0

我真的需要使用 Xcode 11.3.1 以 3.5 屏幕尺寸特别是 iPhone 4s 测试我的应用程序的布局,但不幸的是 iPhone 4s 不可用。我有带有 Mac OS Catalina 的 Xcode 11.3.1,我相信按照我的 macOS 的规范添加 9.0 模拟器是不可能的。我尝试下载iPhoneSimulatorSDK9.3iPhoneSimulatorSDK9.0但没有成功。下图是我尝试安装时得到的。你有什么办法可以帮助我吗?有什么方法可以在 xcode 11.3.1 中以 3.5 的屏幕尺寸测试我的应用程序?请帮我。谢谢

错误信息

4

2 回答 2

1

使用窗框有一种可能性。您可以在应用程序运行时设置窗口大小。我建议为 iPhone SE 设备配置运行模拟器,然后将此特殊代码仅用于测试。

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
/// Only for testing iphone 3.5in screen on iphone SE simulator
 window?.frame = CGRect(x: 0, y: 0, width: 320.0, height: 480.0)

...
}
于 2020-08-24T09:18:16.690 回答
0

Rafiki 的解决方案效果很好。这是在目标 C 中:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    @synthesize window;
    …
    UIStoryboard* iPhoneStoryboard = [UIStoryboard storyboardWithName:@"StoryboardFor35inch" bundle:nil];
    UIViewController* initialViewController = [iPhoneStoryboard instantiateInitialViewController];
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    window.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
   …
}
于 2021-08-14T01:42:57.270 回答