您的位置:首页 > 其它

cell separator line 不能到头

2015-11-10 18:00 274 查看
//Setup your cell margins:

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath {
    // Remove seperator inset
    if ([cell
respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    // Prevent the cell from inheriting the Table View's margin settings
    if ([cell
respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
        [cell setPreservesSuperviewLayoutMargins:NO];
    }
    // Explictly set your cell's layout margins
    if ([cell
respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
    if([tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
    {
        tableView.cellLayoutMarginsFollowReadableWidth =
NO;
    }
}

#pragma //correct iOS9 the cell separator line not to left
-(void)viewDidLayoutSubviews
{
    [super
viewDidLayoutSubviews];
    
    // Force your tableview margins (this may be a bad idea)
    if ([self.tableView
respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.tableView
setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([self.tableView
respondsToSelector:@selector(setLayoutMargins:)]) {
        [self.tableView
setLayoutMargins:UIEdgeInsetsZero];
    }
    if([self.tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
    {
        self.tableView.cellLayoutMarginsFollowReadableWidth =
NO;
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: