Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No NIBs, UIWindow Not Filling Screen, iOS 7

I'm avoiding using NIBs completely. I'm getting problems on iOS 7.1, but not on iOS 8.x.

iOS 7 vs. iOS 8

iOS 7iOS 8

The code looks like this in the UIResponder <UIApplicationDelegate>

- (void) setupViewController {
    CGRect frame = UIScreen.mainScreen.bounds;
    self.window = [[UIWindow alloc] initWithFrame:frame];
    self.window.backgroundColor = UIColor.whiteColor; // viewController's view is green
    ViewController *viewController = [[ViewController alloc] init];
    UIView *view = [[UIView alloc] initWithFrame:self.window.bounds];
    viewController.view = view;
    self.window.rootViewController = viewController;
    [self.window makeKeyAndVisible];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self setupViewController];
    return YES;
}

I've also tried some methods dealing with iOS 8, but even settings the UIWindow frame to 5000, 5000 produces the same results.

[I've seen a number of related questions and tried out the suggestions, but to no avail, including flipping the bounds if it's iOS 8, etc. etc.]

like image 294
Dan Rosenstark Avatar asked Feb 04 '15 20:02

Dan Rosenstark


1 Answers

The problem is that you don't have a launch image for the 4-inch screen, so the iPhone 5s is treating this app as a 3.5-inch app (iPhone 4) and letterboxing it.

like image 140
matt Avatar answered Nov 16 '22 14:11

matt