您的位置:首页 > 其它

去除TableView的边框线. (分割线 ,下划线就这个意思)

2015-08-19 17:30 423 查看
一,

UITableViewStylePlain类型的UITableView去除边框线有直接的属性方法:

separatorStyle = UITableViewCellSeparatorStyleNone;

但在UITableViewStyleGrouped类型的UITableView中,该方法无效!

如何去除边框线呢?答案很简单:

separatorColor=[UIColor clearColor];

二,

在UITableViewStyleGrouped这个类型下, tableView会有一个高度是35的组间距,也就是viewForHeader中的view的高度.重新设置一下这个view就好了.

- (CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section

{

    return 1;

}

- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section

{

    return 1;

}

-(UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section

{

    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];

    view.backgroundColor = [UIColor clearColor];

    return view;

}

- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section

{

    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];

    view.backgroundColor = [UIColor clearColor];

    return view;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息