Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6545963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:39:03+00:00 2026-05-25T11:39:03+00:00

Consider the following app delegate entry point: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window

  • 0

Consider the following app delegate entry point:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    // Custom view controller
    main = [[MainView alloc] initWithNibName:@"MainView" bundle:nil];
    [self.window addSubview:main.view];

    return YES;
}

Everything is Apple stock code, except the “custom view controller” part. There, a custom view controller is grabbed, and effectively added as the main view of the app.

Problem: the widgets in the view are 20px above where they should be. In other words, top 20px of the view’s contents are obscured by the status bar.

But: after rotation, the view and its contents are positioned correctly, and the status bar overlap no longer appears.

What’s going on here? And specifically, what’s the pattern/best practice to make sure that things are positioned correctly also when adding the subview to the window initially?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:39:04+00:00Added an answer on May 25, 2026 at 11:39 am

    You are using the wrong method for initializing your UIWindow’s frame. Yous should be using [[UIScreen mainScreen] applicationFrame] for exactly the reason you are talking about. Read this for more (basically applicationFrame takes care of the status bar issue).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the Following object model (->> indicates collection): Customer->Orders Orders->>OrderLineItems->Product{Price} The app is focused
Consider the following requirement for building a forum App Parent Post - Child Post1
consider the following scenario: I have a storyboard-based app. I add a ViewController object
Consider the following image: My app first finds all the blue pixels and also
Consider the following situation: - Suppose my app allows users to create the states
I have an app that's about presenting fictional simplified cities. Please consider the following
Consider the following setup: A webapplication deployed on a Websphere Application Server (6.1 if
Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies): using Facebook; var app
Consider the following app architecture: UI (View) Thread creates a ViewModel. ViewModels constructor requests
Okay, consider the following: A app/views/pages/index.html.erb , consisting of: <div id='content'> <%= link_to 'Test',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.