title: Creating a UISearchBar and UITableView inside a UIView
body: <p>Disclaimer: I'm something of an iOS n00b. I have a navigation-based app -- i.e., in my AppDelegate, I create the nav frame:</p>
  
  <pre><code>self.navigation_controller = [[UINavigationController alloc] initWithRootViewController:home_view_controller];
  self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  self.window.rootViewController = navigation_controller;
  self.window.makeKeyAndVisible;
  </code></pre>
  
  <p>Inside the frame of my home view, I want a search bar, then the scrollable table view. So, I wrote this:</p>
  
  <pre><code>- viewDidLoad{
    (HomeView*)home_view = [[HomeView alloc] init];
    self.view = home_view
    self.view.backgroundColor = [UIColor whiteColor]
  
    (UITableView*)self.table_view = [UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.table_view.bounds.origin.y += 44;
    self.table_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.table_view.dataSource = self;
    self.table_view.delegate = self;
    [self.view addSubview:self.table_view];
  
    search_frame = self.view.bounds;
    search_frame.origin.y = 48.0;
    search_frame.size.height = 48.0;
  
    self.search_bar = [[UISearchBar alloc] initWithFrame:search_frame)];
    [self.view addSubview:self.search_bar];
  }
  </code></pre>
  
  <p>The table view displays fine, but occupies all the space below the navigation bar. I want to have the navigation bar, then immediately below it the search bar, followed by the table view. At the point of <code>viewDidLoad</code>, the <code>UITableView</code> does not yet have a non-zero bounding rect and I expect that's part of the problem. Additionally, I've specified <code>UIViewAutoresizingFlexibleHeight</code> in my <code>autoresizingMask</code> when I really want it glued against the search bar -- again, I believe this may be part of the problem.</p>
  
  <p>What have I misunderstood here?</p>
  
  <p>Thanks</p>