iOS TableViewCell 底下线显示不全解决方案

来源:互联网 发布:.eps用什么软件打开 编辑:程序博客网 时间:2024/05/16 09:50

-(void)viewDidLayoutSubviews {

    if ([self.tableViewrespondsToSelector:@selector(setSeparatorInset:)]) {

        [self.tableViewsetSeparatorInset:UIEdgeInsetsZero];

    }

    if ([self.tableViewrespondsToSelector:@selector(setLayoutMargins:)])  {

        [self.tableViewsetLayoutMargins:UIEdgeInsetsZero];

    }

}

if (cell == nil) {

        cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleSubtitlereuseIdentifier:CellIdentifier];

        cell.textLabel.font = [UIFontmy_systemFontOfSize:kGlobalFontSize];

        cell.selectionStyle =UITableViewCellSelectionStyleGray;

        if ([cellrespondsToSelector:@selector(setLayoutMargins:)]) {

            [cell setLayoutMargins:UIEdgeInsetsZero];

        }

        if ([cellrespondsToSelector:@selector(setSeparatorInset:)]){

            [cell setSeparatorInset:UIEdgeInsetsZero];

        }

    }

解决tableView无数据时还显示横线问题:  
    UIView *v = [[UIView alloc] initWithFrame:CGRectZero];
    [tableview setTableFooterView:v];


0 0