UITableView 设置分割线边距

- (void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath

{

    // Remove seperator inset

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

        if(indexPath.row==0) {

            [cellsetSeparatorInset:UIEdgeInsetsZero];

        }else{

            [cellsetSeparatorInset:UIEdgeInsetsMake(0, UC_ADJUST_SCREEN_SIZE(207), 0, 0)];

        }

    }

    // Prevent the cell from inheriting the Table View's margin settings

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

        [cellsetPreservesSuperviewLayoutMargins:NO];

    }

    // Explictly set your cell's layout margins

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

        if(indexPath.row==0) {

            [cellsetLayoutMargins:UIEdgeInsetsZero];

        }else{

            [cellsetLayoutMargins:UIEdgeInsetsMake(0, UC_ADJUST_SCREEN_SIZE(207), 0, 0)];

        }

    }

}

你可能感兴趣的:(UITableView 设置分割线边距)