搜索
ios - UITableViewStylePlain UITableView 如何不显示分割线
怪我咯
怪我咯 2017-04-17 11:11:20
[iOS讨论组]

我的UITableView是UITableViewStylePlain风格的,这样整个TableView都会被分割线分隔开,不管有没有数据,非常丑。。。
比如下图,我只有4行数据

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}


找了好久没有找到相关的选项,让有数据的Cell才显示分割线,没有数据的不显示。
求解一个方案。。。

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(6)
PHPz

将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone即可,如下:

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
高洛峰

设置每个section里面的行数试试

伊谢尔伦
UIView *v = [UIView alloc] initWithFrame:CGRectMake(0,0,320,80)];
tableview.tableFooterView = v;
[v release];
高洛峰

self.table.tableFooterView = [[UIView alloc] init];

迷茫

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

每个Cell下面添加一条自己写的直线

PHPz

[tableview setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板