Created
August 5, 2014 16:31
-
-
Save MosheBerman/33c2f50049e10085b007 to your computer and use it in GitHub Desktop.
What I tried before using a solid image.
This file contains hidden or 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
| - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller | |
| { | |
| [self colorAllTheViews:self.searchDisplayController.searchBar.superview]; | |
| } | |
| - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller | |
| { | |
| [self fungeBackdrop]; | |
| } | |
| - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller | |
| { | |
| NSLog(@"Search will end."); | |
| } | |
| - (void)fungeBackdrop | |
| { | |
| UIView *backdrop = [self backdropViewInSearchBar:self.searchDisplayController.searchBar.superview]; | |
| backdrop.opaque = YES; | |
| backdrop.backgroundColor = [BRKThemeManager sharedManager].maroonColor; | |
| } | |
| /** | |
| * | |
| */ | |
| - (void)colorAllTheViews:(UIView *)view | |
| { | |
| for (UIView *subview in view.subviews) | |
| { | |
| // | |
| if (subview.alpha == 0.85) | |
| { | |
| subview.alpha = 1.0; | |
| subview.backgroundColor = [BRKThemeManager sharedManager].maroonColor; | |
| [self colorAllTheViews:subview]; | |
| } | |
| } | |
| } | |
| /** | |
| * Attempt to extract private view. Whelp! | |
| */ | |
| - (UIView *)backdropViewInSearchBar:(UIView *)view | |
| { | |
| UIView *backdrop = nil; | |
| for (UIView *subview in view.subviews) | |
| { | |
| backdrop = [self backdropViewInSearchBar:subview]; | |
| if(!backdrop) | |
| { | |
| NSString *className = [NSStringFromClass([subview class]) lowercaseString]; | |
| BOOL isBackdrop = [className rangeOfString:@"back"].location != NSNotFound; | |
| if (isBackdrop) { | |
| backdrop = subview; | |
| break; | |
| } | |
| } | |
| } | |
| return backdrop; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment