Search code examples
objective-ciosuisearchbaruisearchdisplaycontroller

UISearchDisplayController showing white instead of gray table cell borders


I came across this issue a long time ago, and fixed it, but now I have no clue how I did it, and I'm coming across it in another controller.

I am using the following code to make the keyboard automatically show up when I show my view that as a search bar:

[self.rootController.changeClientViewController.searchDisplayController.searchBar becomeFirstResponder];
[self.rootController.changeClientViewController.searchDisplayController setActive:YES];

The keyboard pops up, like it should, but the lines in between each table cell are white, instead of dark-grey, and it looks bad. I am using the same code in another place to automatically pop up the keyboard; and there the lines are dark-grey as expected. Has anyone come across this? I could link to a screenshot if it would be helpful...


Solution

  • Here's one way to fix it: becomeFirstResponder after a minuscule delay, i.e.

    [self.rootController.changeClientViewController.searchDisplayController.searchBar
        performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];