How do I remove the borders of a UITableView?

混江龙づ霸主 提交于 2019-12-28 04:54:36

问题


I have subclassed the UITableView control, and the style is grouped, but I do not need the cell separators. I tried setting my table view's separatorStyle to none, but it doesn't work. Can any one help me out?


回答1:


In a grouped table view, setting separatorStyle doesn't do anything. If you want to hide it, just do the following:

tableView.separatorColor = [UIColor clearColor];



回答2:


Use this

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;



回答3:


To remove the border of a table view write this line:

self.myTableView.separatorColor = [UIColor clearColor];

If you want to remove both the border of a table view but the border between cells too, you have to write both lines:

self.myTableView.separatorColor = [UIColor clearColor];
self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;



回答4:


This did the trick for me:

[dayTableView setSeparatorColor:[UIColor whiteColor]]; //or your background color



回答5:


How about setSeparatorColor to your cell's background color?




回答6:


swift 4 use

myTableView.separatorStyle = UITableViewCellSeparatorStyle.none


来源:https://stackoverflow.com/questions/286332/how-do-i-remove-the-borders-of-a-uitableview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!