title: Creating a UISearchDisplayController programmatically
body: <p>I'm trying to create a <code>UISearchDisplayController</code> programmatically. I have a method which should set up my search controller, but when I call it, nothing happens.</p>
  
  <p>This my <code>-setupSearch</code> method:</p>
  
  <pre><code>- (void)setupSearch {
      UISearchBar *myBar;
      UISearchDisplayController *myCon;
  
      myBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
      [myBar sizeToFit];
  
      myCon = [[UISearchDisplayController alloc]
               initWithSearchBar:myBar contentsController:self];
      [myBar release];
  
      myCon.delegate = self;
      myCon.searchResultsDataSource = self;
      myCon.searchResultsDelegate = self;
  
      /* Setup scopes */
      {
          NSMutableArray *scopes;
          NSUInteger count, i;
          NSString *aScope;
  
          count = SCOPE_COUNT;
          scopes = [[NSMutableArray alloc] initWithCapacity:count];
          for(i = 0; i &lt; count; i++) {
              // I create four scopes here
          }
  
          myCon.searchBar.scopeButtonTitles = scopes;
          [scopes release];
      }
  
      [myCon release];
  }
  </code></pre>
  
  <p>I call the above method in the <code>-viewDidLoad</code> method of my subclassed <code>UITableViewController</code>. Unfortunately nothing happens when my table view controller get's displayed in a <code>UITabBarController</code>.</p>
  
  <p>Any help would be greatly appreciated.</p>