您的位置:首页 > 其它

调整cell的间距

2015-09-08 16:37 239 查看
-(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的位置
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: