Min Tsai Min Tsai -4 years ago 116
iOS Question

White background is showing above UISearchBar for iOS7

My viewController has a UISearchBar set as the header view of a UITableView.

self.tableView.tableHeaderView = self.searchBar;


In iOS7, pulling down beyond the UISearchBar reveals a white space that does not obey the dark color set using self.tableView.backgroundColor.

enter image description here

Is there a way to get rid of the white space?

Answer Source

I managed to get rid of that color by setting a table view background view.

UIView *backgroundView = [[UIView alloc] initWithFrame:self.tableView.bounds];
backgroundView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = backgroundView;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download