Instantly share code, notes, and snippets.

@YQRush /Example.m
Last active Jun 13, 2018

What would you like to do?
UIView* backgroundView = [searchBar subViewOfClassName:@"_UISearchBarSearchFieldBackgroundView"];
backgroundView.layer.cornerRadius = 14.0f;
backgroundView.clipsToBounds = YES;
- (UIView*)subViewOfClassName:(NSString*)className {
for (UIView* subView in self.subviews) {
if ([NSStringFromClass(subView.class) isEqualToString:className]) {
return subView;
UIView* resultFound = [subView subViewOfClassName:className];
if (resultFound) {
return resultFound;
return nil;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment