2

I have a UITableView (which happens to have a UISearchBar) and can't seem to figure out how to get rid of the white/gray border above it. I need to have seamless black between the UISearchBar and the black above it.

I have tried hiding the UISearchBar to see if that had anything to do with it, but the line still appeared.

Any ideas?

Line

EXC_BAD_ACCESS
  • 346
  • 1
  • 4
  • 19
Tom
  • 247
  • 1
  • 17

4 Answers4

9

In my case it helped to set:

    searchBar.clipsToBounds = YES;
Kai
  • 1,350
  • 13
  • 23
1

You have to customise the UISearchBar background to match according to your requirements.,take a look at this tutorial.

Sharon Nathaniel
  • 1,467
  • 20
  • 28
  • I have tried using an image as the background for the UISearchBar, but that did not work - It is really the top of the UITableView that has that line. I have also tried the following: [code] [self.searchBar setBarStyle:UIBarStyleBlackTranslucent]; self.searchBar.backgroundColor = [UIColor blackColor]; for (id img in self.searchBar.subviews) { if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) { [img removeFromSuperview]; } }[/code] – Tom Jan 09 '13 at 13:00
1

You should try this, by which you can set the color of cell borders and if you want to change the color of a particular cell's border put it in condition as: if (indexPath.row == yourcell):

tableView.separatorColor = [UIColor blackColor];

Also the above method you have to put in CellForRowAtIndexPath method of table view datasource.

Please notify if it works..

Ashutosh
  • 2,215
  • 14
  • 27
  • That did indeed change the separator color to black, however the line at the top of the tableview is still gray. – Tom Jan 09 '13 at 12:58
1

This had to do with the pullToRefresh view I was using (using SensibleTableView) - it had some code in drawRect to draw the line.

Tom
  • 247
  • 1
  • 17