首页 > 其他 > 详细

调整cell的间距

时间:2015-09-08 18:04:48      阅读:248      评论:0      收藏:0      [点我收藏+]
-(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的位置 

调整cell的间距

原文:http://www.cnblogs.com/athook/p/4792202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!