删除UITableView的边框,而不是分隔符

时间:2013-04-25 06:05:09

标签: ios objective-c uitableview

我想删除UITableView的边框,默认情况下,单元格和表格周围有一条灰线。注意我只想删除表格周围的边框而不是单元格之间的分隔符。

我已搜索但只找到删除所有行的答案。此代码删除了单元格和表格之间的所有边框:

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

此代码不起作用,没有任何反应:

#import <QuartzCore/QuartzCore.h>
self.table.layer.borderColor = [UIColor redColor].CGColor;

我的表是一个分组的表视图,默认情况下在xib中,而分隔符是单行。

5 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我所做的就是删除边框并使用自定义TableViewCell底部的Imageview添加自定义分隔符。

答案 1 :(得分:1)

试试这个。

self.yourTableView.tableHeaderView = [[UIView alloc] init];
self.yourTableView.tableFooterView = [[UIView alloc] init];

答案 2 :(得分:0)

尝试设置tableview border width = 0

答案 3 :(得分:0)

我有同样的问题并找到了这个解决方案......

self.table.backgroundColor = [UIColor clearColor];

self.table.backgroundView = nil;

希望它可以帮到你!

答案 4 :(得分:-5)

请尝试:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
相关问题