• 调整cell的间距


    -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
        if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
            self = [[NSBundle mainBundle] loadNibNamed:@"MessageNotificationTableViewCell" owner:nil options:nil][0];
            // self.contentView.backgroundColor=[UIColor clearColor];
            //self.backgroundColor=[UIColor clearColor];
            self.selectionStyle=UITableViewCellSelectionStyleNone;
            UIView *view = [[UIView alloc ]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
            
            view.backgroundColor =MAIN_COLOR_GRAY;
            
            [self.contentView addSubview:view];
            
           
        }
        return self;
    }

    另一种方法

    自定义cell,然后重写cell的setFrame方法
    -(void)setFrame:(CGRect)frame {
        frame.y += 10;
        [super setFrame:frame];
    }

    每个cell设置frame时,都给它的y值增加10的位置 

  • 相关阅读:
    vue中使用第三方UI库的移动端rem适配方案
    前端规范--eslint standard
    从上往下打印二叉树
    栈的压入,弹出序列
    随机森林
    LR
    顺时针打印矩阵
    包含min函数的栈
    树的子结构
    合并两个有序链表
  • 原文地址:https://www.cnblogs.com/athook/p/4792202.html
Copyright © 2020-2023  润新知