I have a UISearch Bar with a few Placeholders. I'm making a simple search app for learning iOS, so I'm really new. I found that there was a weird line that was coming behind my UISearchBar whenever I started editing it as in the image :
My SearchBar code is pretty much the standard as any other search bar. I've tried doing the following, but they haven't worked :
// [self.searchBar setBackgroundColor:[UIColor redColor]];
// self.searchBar.clipsToBounds = YES;
// searchBar.layer.borderWidth = 1;
// searchBar.layer.borderColor = self.searchBar.layer.borderColor;
// CGRect maskingLine = self.searchBar.frame;
// UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(maskingLine.origin.x, maskingLine.origin.y+20, maskingLine.size.width, 10)];
// lineView.backgroundColor = [UIColor greenColor];
// [self.searchBar addSubview:lineView];
You are adding (for some unknown reason) a subview called lineView
to the search bar. That line you are seeing is the lineView
.