美文网首页
UITableView的separatorInsets设置

UITableView的separatorInsets设置

作者: 崔石炫 | 来源:发表于2016-07-06 12:25 被阅读0次
    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
      // Remove seperator inset
      if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
          [cell setSeparatorInset:UIEdgeInsetsMake(0,12,0,0)];
      }
    
      // 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:UIEdgeInsetsMake(0,15,0,0)];
      }
    }
    

    相关文章

      网友评论

          本文标题:UITableView的separatorInsets设置

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