重写单元格

2017-11-04  本文已影响0人  法库德

.h

创建Chongbiaoge继承UITableViewCell

@property(nonatomic,strong)UIImageView *ima;

@property(nonatomic,strong)UILabel *lab;

@property(nonatomic,strong)UILabel *lab1;

.m

-(UIImageView*)ima

{

if (_ima==nil)

{

_ima=[[UIImageView alloc]initWithFrame:CGRectMake(10, 20, 50, 50)];

[self addSubview:_ima];

}

return _ima;

}

-(UILabel*)lab

{

if (_lab==nil)

{

_lab=[[UILabel alloc]initWithFrame:CGRectMake(65, 20, 100, 30)];

[self addSubview:_lab];

}

return _lab;

}

-(UILabel*)lab1

{

if (_lab1==nil)

{

_lab1=[[UILabel alloc]initWithFrame:CGRectMake(65, 40, 300, 90)];

_lab1.numberOfLines = 0;// 最关键的一句

[self addSubview:_lab1];

}

return _lab1;

}

上一篇下一篇

猜你喜欢

热点阅读