调整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的位置
相关文章推荐
- C#委托与事件
- HTML5+NodeJs实现WebSocket即时通讯
- 不同语言的Unix时间戳
- href="javascript:void(0)"
- react-native试玩(32)-推送通知API
- mysql主从复制
- 从零开始自学Swift(一)
- XMPP 两个客户端实现文件传输
- Spring Assert(方法入参检测工具类-断言)
- NIO框架之MINA源码解析(三):底层通信与责任链模式应用
- Java多线程之七锁
- 1062 - Duplicate entry '20150820048' for key 'goods_serial'
- EF使用时异常:对一个或多个实体的验证失败。有关详细信息
- jquery笔记之属性选择器 查找以某种条件开头的页面元素
- nimi SearchEngin 项目思路及算法
- Treasure Hunt - POJ 1066(线段相交判断)
- PN结的形成及其单向导电性.md
- 15_09_08 Log.i();初学者易范错误
- 九度题目1207:质因数的个数
- 智能指针(二):shared_ptr实现原理