zoukankan      html  css  js  c++  java
  • 调整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的位置 

  • 相关阅读:
    获取时间对象
    定时器
    undefined与return
    获取设置非行间样式
    NaN
    return,break与continue的区别
    数据类型
    程序的机器级表示
    计算机内数字的表示
    计算机系统漫游
  • 原文地址:https://www.cnblogs.com/athook/p/4792202.html
Copyright © 2011-2022 走看看