美文网首页
TableView去掉多余cell线,系统分割线顶格

TableView去掉多余cell线,系统分割线顶格

作者: 遥想月下 | 来源:发表于2016-08-31 16:39 被阅读167次

转自iOS_愛OS的TableView 去掉多余行数、IOS最后一行Cell系统分割线顶格http://www.jianshu.com/p/1290f6aa1774

  1. tableView分割线顶格
    使用方法:cellForRow中调用 setLastCellSeperatorToLeft(cell);
    // tableView分割线顶
    static 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];
     }
     }
    
  2. tableView去掉多余的分割线
    //去掉多余的表格线
    [self.tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];

相关文章

网友评论

      本文标题:TableView去掉多余cell线,系统分割线顶格

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