UITable
that has a UISearchDisplayController
. UITable
is less than the width of the screen (it's 280px width centered). search bar
, the UISearchDisplayController
table is all the way to the left of the screen. UISearchDisplayController
, I still get the same positioning. I set the frame here:
- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView {
tableView.backgroundColor = [UIColor colorWithRed:29.0/255.0 green:30.0/255.0 blue:32.0/255.0 alpha:1];
tableView.rowHeight = self.myTable.rowHeight;
tableView.frame = myTable.frame;
NSLog(@"search table origin: %f",tableView.frame.origin.x);
}
Even weirder, when I log the search table position at the end, it shows 16. However, it is at position 0 in the view.
Any help is appreciated.
I answered my own question. The frame needs to be set in this delegate method:
- (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView {
tableView.frame = self.myTable.frame;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With