tableviewcell里面 划线---横向与纵向添加

 一、纵分割线 

//x  y  high 改为你的位置
    UIView *verticalLine = [[UIView alloc]initWithFrame:CGRectMake(x, y , 1, high)];
    verticalLine.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:verticalLine];

  二、横分割线  

   //x   y  width 改为你的位置
    UIView *horizontalLine = [[UIView alloc]initWithFrame:CGRectMake(x, y, width, 1)];
    horizontalLine.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:horizontalLine];

如果是在一般视图划线,将contentView改为view就可以了。

猜你喜欢

转载自blog.csdn.net/C_philadd/article/details/84098825
今日推荐