我是否需要为更大的新 iPhone 5 显示器配备单独的视图控制器? [英] Will I need a separate View Controller for the new larger iPhone 5 display?

查看:28
本文介绍了我是否需要为更大的新 iPhone 5 显示器配备单独的视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常笼统的问题 - 但我在任何地方都找不到直接的答案!如果有人知道,请赐教!

I have a pretty general question - but I can't find a straight answer anywhere! If someone knows, please enlighten me!

我想知道用新的 iPhone 5 尺寸提交到 App Store 的计划.我假设如果我们不希望它们在新设备上用字母装箱,我们都需要为我们所有的应用程序制作新的图形和单独的视图?所以我的问题是,我是否要制作一个仅针对此设备的新视图控制器?如果是这样 - 我应该在这段代码中加入什么来实现这一点?(如您所见,我已使用 iPad 视图完成)

I wanted to know the plan for submitting to the App Store with the new iPhone 5 dimensions. I assume that we will all need to make new graphics and separate views for all our apps if we don't want them letter boxed on the new device? So my question is, am I going to just make a new view controller that targets just this device? If so - what do I put into this code to make that happen? (as you see I've done it with the iPad view)

AppDelegate.mm

AppDelegate.mm

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
    } else {
        self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
    }
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

期待发现!谢谢!肖恩

推荐答案

您不必重做所有事情.那会很疯狂.您只需要获取屏幕或主窗口的大小,而不是硬编码 480 点高度.并设置自动调整大小的遮罩具有灵活的高度.

You don't have to redo everything. That would be crazy. You just have to get the size of the screen or the main window instead of hardcoding a 480 point height. And set the autoresizing mask to have flexible height.

这篇关于我是否需要为更大的新 iPhone 5 显示器配备单独的视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆