OGeek|极客世界-中国程序员成长平台

标题: ios - 制作4寸尺寸的iPhone应用,如何通用? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:24
标题: ios - 制作4寸尺寸的iPhone应用,如何通用?

我为 iPhone 制作了一个应用程序,所有的东西都有 iPhone5 4"尺寸。 模拟器运行良好,在我的 iPhone 上运行良好。

现在,我知道要在 iPhone 3.5"屏幕和 iPad 上发布游戏,我必须在同一个项目文件中创建文件。

我有:

  1. Iphone4":

  2. Iphone3.5":

  3. iPad:

我有几个问题:

  1. 下载器设备如何检测要使用的文件夹 游戏出处?

  2. 当我在 3.5"中运行模拟器时,尽管在 3.5"设置中创建了应用程序,但它仍然会获取在 4"文件夹中创建的 Storyboard。但是,当我运行 iPad 模拟器时,它会在iPad 文件夹。简而言之,我如何让 Xcode 检测何时应该在模拟器中使用 4"尺寸或何时使用 3.5"尺寸?

  3. 如果我在 App Store 上以 4 英寸游戏的形式发布该应用,那么在 iPhone4 或更早版本上下载它的人是否仍然可以玩它(即它会自动缩放吗?)

很高兴通过 Skype 或其他媒体进一步讨论。将不胜感激。

亲切的问候,

最大



Best Answer-推荐答案


您正在使用 Storyboard,所以这是您的应用委托(delegate)

- (UIStoryboard *)grabStoryboard {

UIStoryboard *storyboard;

// detect the height of our screen
int height = [UIScreen mainScreen].bounds.size.height;

if (height == 480) {
    storyboard = [UIStoryboard storyboardWithName"Main" bundle:nil];
    // NSLog(@"Device has a 3.5inch Display.");
} else {
    storyboard = [UIStoryboard storyboardWithName"MainRetina" bundle:nil];
    // NSLog(@"Device has a 4inch Display.");
}

return storyboard;

}

然后在您的 View 中确实加载了这个:

UIStoryboard *storyboard = [self grabStoryboard];

如果您使用的是 iPad,请为此添加大小并将您的 Storyboard重命名为该效果

关于ios - 制作4寸尺寸的iPhone应用,如何通用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24274130/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4