iOS 设置最后一行的分割线边距为零

来源:互联网 发布:校园奴隶契约 知乎 编辑:程序博客网 时间:2024/06/05 17:36

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

在该事件中判断是否为最后一行

再调用该方法

//设置最后一行的分割线边距为零-(void)setLastCellSeperatorToLeft:(UITableViewCell *)cell{    if([cell respondsToSelector:@selector(setSeparatorInset:)])    {        [cell setSeparatorInset:UIEdgeInsetsZero];    }    if([cell respondsToSelector:@selector(setLayoutMargins:)])    {        [cell setLayoutMargins:UIEdgeInsetsZero];    }    if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])    {        [cell setPreservesSuperviewLayoutMargins:NO];    }}

//将多余的行清除-(void)hideline{    _tb.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];}





0 0