美文网首页
UITableView - separator

UITableView - separator

作者: AlexLi_ | 来源:发表于2017-09-25 16:43 被阅读33次

设置颜色

UITableView 属性: separatorColor
_tableView.separatorColor = [UIColor blackColor];

隐藏多余的线

设置 UITableView 的 tableFooterView 
_tableView.tableFooterView  = [UIView new];

隐藏最后一条线

重写代理方法: -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    cell.separatorInset = UIEdgeInsetsMake(0, 0 , 0, 0 );
    

    if (indexPath.row==dataArray.count-1) {
        cell.separatorInset = UIEdgeInsetsMake(0, ScreenWidth , 0, 0);
    }
}



相关文章

网友评论

      本文标题:UITableView - separator

      本文链接:https://www.haomeiwen.com/subject/nyjdextx.html