Will I need a separate View Controller for the new larger iPhone 5 display?

拥有回忆 提交于 2019-12-11 13:42:20

问题


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

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

- (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;
}

Looking forward to finding out! Thanks! Sean


回答1:


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.




回答2:


I have an app that was already in the app store and I wanted to update it for the new screen resolution. The simple answer is that I added a blank screenshot into the Retina 4-inch launch image. Once this was done, the app resized itself. My app is all table and web view with text and photo entry, so it resized beautifully.

I did try several things before discovering this, but I removed all other changes once I discovered that the Launch Image was the reason my app wasn't loading full screen.



来源:https://stackoverflow.com/questions/12415824/will-i-need-a-separate-view-controller-for-the-new-larger-iphone-5-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!