Note that there are some explanatory texts on larger screens.

plurals
  1. POUIViewController with UITableViews and UISearchBar
    primarykey
    data
    text
    <p>previously I had a <code>UITableViewController</code> with a <code>UISearchBar</code> and it was showing up at the top by using <code>self.tableView.tableHeaderView = searchBar;</code> </p> <p>Now I had to redo some things and ended up with a <code>UIViewController</code> which shows 2 <code>UITableView's</code>. I wanted the upper one to show the search bar but now it's not being shown.</p> <p>Now I'm using <code>[MyView setTableHeaderView:searchBar];</code> in <code>viewDidLoad</code> Method to add the searchBar to the TableView. </p> <p>In the <code>UIViewController</code> the code is almost the same as in the <code>UITableView</code> (searchbar initialized and frame created as well as tableview initialized)</p> <p>Any ideas what I'm doing wrong?</p> <p>EDIT: Idea behind all this to have a list in the upper tableview (including search bar) and another uitableview where I can choose some filtering options.</p> <pre><code>(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization searchResult = [[NSMutableArray alloc] init]; LexikonView = [[UITableView alloc] initWithFrame:CGRectMake(0, 44, 320, 337) style:UITableViewStylePlain]; LexikonView.dataSource = self; LexikonView.delegate = self; [self.view addSubview:LexikonView]; FilterView = [[UITableView alloc] initWithFrame:CGRectMake(0, 381, 320, 0) style:UITableViewStylePlain]; //FilterView.dataSource = self; //FilterView.delegate = self; [self.view addSubview:FilterView]; } return self; } (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; searchBar.autocorrectionType = UITextAutocorrectionTypeYes; searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchDisplayController.delegate = self; searchDisplayController.searchResultsDataSource = self; [LexikonView setTableHeaderView:searchBar]; } </code></pre> <p>For now I just want the searchbar to work again (as it did using a uitableviewcontroller). If I reduce the size of the upper tableview I only see empty space. I added a UISearchBar in IB and voilá there it is, but the delegate methods are not called.<br> And yes I want the searchbar to be always visible at the top of the tableview</p>
    singulars
    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.
    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