• Table的分割线偏移量设置 及其 UIEdgeInset详解


     1 -(void)viewDidLayoutSubviews {
     2     
     3     if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
     4         [self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 85, 0, 0)];
     5         // 设置分割线的 偏移量  分割线向右移动85   要是向左改成UIEdgeInsetsMake(0, 0, 0, 85)
     6     }
     7     if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])  {
     8 //这个是整个table的margin
     9         //[self.tableView setLayoutMargins:UIEdgeInsetsMake(0, 85, 0, 0)];
    10     }
    11 }
    UIEdgeInsetsMake(0, 85, 0, 0)
    UIEdgeInsetsMake(top, left,bottom, right )
    这里的4个参数 其实就是 距离上边距离为top ,距离左边left,距离底部bottom,距离右边right。

    每一个view 都是一个容器,这些距离都是距离容器的边框的距离。


    但是分割线和右边的灰色的箭头 都会偏移,用的时候注意了



    所以我又想到其他的想法,就是把系统的line 隐藏,自己重写cell中的
    - (void)drawRect:(CGRect)rect
    
    {
    
        UIColor * color =[UIColor lightGrayColor];
    
        [color set]; //设置颜色
    
        UIBezierPath * bezier=[[UIBezierPath alloc]init];
    
        bezier.lineWidth = 0.3 ; //设置线宽度
    
        CGFloat y = CGRectGetHeight(self.contentView.frame)-1;
    
        [bezier moveToPoint:CGPointMake(85, y)];//线的起点
    
        [bezier addLineToPoint:CGPointMake(kScreenWidth, y)]; //连两点之间的线
    
        [bezier closePath];
    
        [bezier stroke]; //画线
    
    }


  • 相关阅读:
    Java IO流-NIO简介
    Java IO流-Properties
    Java IO流-序列化流和反序列化流
    Codeforces Round #371 (Div. 1) C
    bzoj 2326 矩阵快速幂
    IndiaHacks 2016
    HDU
    Educational Codeforces Round 51 (Rated for Div. 2) F
    Codeforces Round #345 (Div. 1) D
    Codeforces Round #300 E
  • 原文地址:https://www.cnblogs.com/fgyqbs/p/4615428.html
Copyright © 2020-2023  润新知