Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Custom View Size Inside UINavigationController When Toolbar Shown
    primarykey
    data
    text
    <p>I have a pretty straightforward setup: A <code>UINavigationController</code> with <code>setToolbarHidden NO</code>. So the container for the custom view inside the stuff owned by the <code>UINavigationController</code> should be the distance from the bottom of the navigation bar to the top of the toolbar. <img src="https://i.stack.imgur.com/SJ1Yr.png" alt="expected distance"></p> <p>However, what I get is (as you might be able to glean from the screen shot by looking through the translucent toolbar) the distance from the bottom of the nav bar to the bottom of the screen.</p> <p>I've set the <code>autoresizingMask</code> to <code>UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth</code> in my <code>viewDidAppear</code>, but it never gets the "right" answer that takes the toolbar height into account. I can calculate the toolbar height and subtract it from the view height, resetting the height of the custom view, but the real problem re-emerges when the device is rotated. This seems like an autoresize kind of problem and I'm baffled why the toolbar isn't taken into account.</p> <p>Any tips how to have the custom view resize, taking the space the toolbar occupies into account?</p> <p>A couple of notes:</p> <ol> <li><p>I am creating all of this programmatically, not using IB</p></li> <li><p>I've examined it in Symbiote, which is very reliable (at least for me) and it verifies what I can see and measure via <code>NSLog</code> output</p></li> </ol> <p>I see apps doing this all the time, so I feel like I must be missing something.</p> <p>Code:</p> <pre><code>// Code translated from RubyMotion view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; self.tableView = [[UITableView alloc] initWithFrame:view.bounds style:UITableViewStylePlain]; self.tableView.accessibilityLabel = @"events table"; self.tableView.backgroundColor = [UIColor whiteColor]; [self.tableView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth]; self.tableView.dataSource = self; self.tableView.delegate = self; self.tableView.tableHeaderView = searchBar; // assume I created a searchbar [self.view addSubview:self.tableView]; </code></pre> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload