-->

Will I need a separate View Controller for the new

2019-08-03 04:06发布

问题:

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.