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

  • SEARCH
  • Home
  • 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 8448969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:34:14+00:00 2026-06-10T10:34:14+00:00

I am trying to add a UITableView object that covers up the whole screen,

  • 0

I am trying to add a UITableView object that covers up the whole screen, by

  UITableView *tabelView = [[UITableView alloc] initWithFrame:self.view.bounds];
  [self.view addSubview:tabelView];

but I realized that even if a physical iPad 2 is rotated to Landscape mode, self.view.bounds is {{0, 0}, {768, 1004}} in viewDidLoad and viewWillAppear. Only in viewDidAppear is it finally {{0, 0}, {1024, 748}}

What is the earliest time that self.view.bounds is set correctly to {{0, 0}, {1024, 748}}? If viewDidAppear is the one, then I have to create the UITableView there, and if the “Launch image” is a static Landscape blank table, then the screen will flash a white screen when viewDidAppear is called, and then the table is added and seen, so a flash of white screen is seen.

So when is the earliest time that self.view.bounds is set correctly to {{0, 0}, {1024, 748}}? It seems like it needs to be slightly before viewDidAppear, so that the blank table is drawn (with the grey lines), and show it and seamlessly get displayed to cover up the Launch image. If the table is created in viewDidLoad or viewWillAppear using self.view.bounds, then the table ends up being 768 points wide and is meant for the Portrait mode.

Update: I just tried to add the Launch image and for some reason, even if the UITableView is added in viewDidAppear, the “flash of white screen” didn’t happen… I don’t know why, but previously if I use CALayer and bitmap to show content, and didn’t use any view or drawRect, then the flash occurred… by the way, the earliest one I found was viewWillLayoutSubviews, and then later in viewDidLayoutSubviews, both of which happened before viewDidAppear, and both showed self.view.bounds as {{0, 0}, {1024, 748}}

Update 2: What if the view is complicated and time consuming to make? To test, I added a usleep(100000); in the tableView:cellForRowAtIndexPath to sleep 0.1 second for each cell, and the “flash” did occur… but cell and table supposedly should be light weight and fast to make, but what if there are other type of views that are more time consuming to make? If I move UITableView creation to viewWillLayoutSubviews, then it is still slow to show something, but at least there is no “flash”. However, later on when I rotate the device, it actually call viewWillLayoutSubviews again and add another table to the main view (with correct screen size), so viewWillLayoutSubviews will need to remove any old table view first, if any, or just resize the old one and not add a new one.

  • 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-06-10T10:34:16+00:00Added an answer on June 10, 2026 at 10:34 am

    The simplest way to avoid the flash is to create the table view in viewDidLoad and set the table view’s autoresizing mask properly, so that the system automatically makes the table view fill its superview:

    - (void)viewDidLoad {
        [super viewDidLoad];
        UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
        tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        [self.view addSubview:tableView];
    }
    

    Otherwise, the earliest time that you can see the final view bounds are in the view controller’s viewWillLayoutSubviews method. You would add your table view once in viewDidLoad, and then adjust its frame in viewWillLayoutSubviews or a method called after that. See my answer to UIViewController returns invalid frame? for more details.

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

Sidebar

Related Questions

I have a standard, grouped UITableView that I am trying to add a custom
I'm trying to add a custom view to an UITableView created with code from
I'm trying to create a custom view for my UITableView footerView that has a
I am trying to add a cover photo above a UITableView, so that the
I´m trying to add a shadow to a grouped UITableView (above each section) like
I'm trying to add a Search bar to my UITableView. I followed this tutorial:
I am trying to add subviews to my UITableView cells. It works just perfect
I've been trying to add a simple layer to my UITableView and it seems
I'm trying to add a UIView on top over the UITableView to mimic the
I'm trying to add a UIPanGestureController to my UITableView so I can detect whether

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.