美文网首页
UITableViewCell的一些属性设置(持续更新...)

UITableViewCell的一些属性设置(持续更新...)

作者: 海耐射手 | 来源:发表于2017-02-16 17:26 被阅读0次

    //Cell添加图片

    cell.imageView.image = [UIImageimage  Named:@"zf_wancheng_"];

    //去掉Cell的选中状态

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    //Cell右侧小尾巴、对勾、编辑等

    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

    //主标题缩进的级别NSItager类型

    cell.indentationLevel = 10;

    //去掉Cell左边空格

    self.tableView.separatorInset = UIEdgeInsetsZero;

    //cell的缩进宽度

    cell.indentationWidth = 10;

    //自定义cell右边的辅助按钮

    cell.accessoryView = view;

    //设置分割线颜色

    [tableView setSeparatorColor :[UIColor redColor] ];

    //自定义cell的背景

    cell.backgroundView = view;

    //cell被选中后就会显现出来的背景/图片

    cell.selectedBackgroundView = view;

    //当cell进入编辑模式时辅助按钮的样式

    cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;

    //当cell进入编辑模式后的辅助按钮

    cell.editingAccessoryView = imageView;

    将原有的tableView分割线取消,然后重新设置tableView的分割线:

    取消原有tableView的分割线:

    self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;

    自定义cell分割线颜色的长、高、颜色:

    - (void)drawRect:(CGRect)rect {

    CGContextRef  context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);

    CGContextFillRect(context, rect);

    //上分割线,

    CGContextSetStrokeColorWithColor(context,[UIColorredColor].CGColor);

    CGContextStrokeRect (context,CGRectMake(5, -1, rect.size.width-10,1));

    //下分割线

    CGContextSetStrokeColorWithColor(context,[UIColorredColor].CGColor);

    CGContextStrokeRect (context,CGRectMake(0, rect.size.height-0.5, rect.size.width,1));

    }

    相关文章

      网友评论

          本文标题:UITableViewCell的一些属性设置(持续更新...)

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