Get rid of line above UITableView

2019-05-20 23:21发布

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

4条回答
贼婆χ
2楼-- · 2019-05-20 23:47

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

查看更多
相关推荐>>
3楼-- · 2019-05-20 23:49

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

查看更多
对你真心纯属浪费
4楼-- · 2019-05-20 23:53

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..

查看更多
劫难
5楼-- · 2019-05-20 23:58

In my case it helped to set:

    searchBar.clipsToBounds = YES;
查看更多
登录 后发表回答