在UITableView中画竖线

来源:互联网 发布:局域网文件同步软件 编辑:程序博客网 时间:2024/05/21 13:32

1.在UITableView中画竖线

最近做ui,所以拜读一下,发现用这个办法,当tableView的style 设置成grouped的时候,无效,貌似。

2.方法2:UILabel 画边框

-(void)setLabelLayer:(NSDictionary*)dicParm

{

   NSArray* labelArray=[dicParmobjectForKey:@"labelArray"];

   float tableViewCellWidth=[[dicParmobjectForKey:@"tableViewCellWidth"]floatValue];

   float tableViewCellHeight=[[dicParmobjectForKey:@"tableViewCellHeight"]floatValue];

   float tabViewOrignY=[[dicParmobjectForKey:@"tabViewOrignY"]floatValue];

   float tabViewOrignX=[[dicParmobjectForKey:@"tabViewOrignX"]floatValue];

    

   float singleLabelLength=tableViewCellWidth/labelArray.count ;

   for (int i=0; i<labelArray.count; i++) 

    {

       UILabel*  label=[labelArrayobjectAtIndex:i];

        [label.layersetBorderColor:[[UIColorgrayColor]CGColor]];

        [label.layersetBorderWidth:2];

        label.frame=CGRectMake(tabViewOrignX+singleLabelLength*i, tabViewOrignY, singleLabelLength, tableViewCellHeight);

    }


}

发现tableviewcell之间会有间隙

3.在页面上,用label 的背景 和tableviewcell的背景拼接出来,一条竖线。

貌似默认的label 是透明的,我想要选择的是白色的,这两个选项看上去是一样的。