Last active
August 29, 2015 14:01
-
-
Save pronebird/7ca113671b63990b3c22 to your computer and use it in GitHub Desktop.
Background color fix for stub view positioned between table view top edge and UISearchBar as header view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Fix background color bug | |
// This patch can be applied once in viewDidLoad if you use UITableViewController | |
// http://stackoverflow.com/q/23026531/351305 | |
// | |
- (void)_fixSearchBarHeaderViewBackgroundColorBug { | |
// First subview in UITableView is a stub view positioned between table's top edge and table's header view. | |
UIView* stubView = [self.tableView.subviews firstObject]; | |
// Make sure it's stub view and not anything else | |
if([NSStringFromClass([stubView class]) isEqualToString:@"UIView"]) { | |
// Set its alpha to zero to use background color from UITableView | |
stubView.alpha = 0.0f; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment