请问如果要让UITableViewCell可重复使用节省内存,但CellStyle又要是Subtitle应该
要怎么写呢?
问过朋友是说需要另外写一个TableViewCell的Subclass,再override init去修改style
依照我自己找出来的方法执行后ViewCellStyle还是default,希望各位前辈能帮忙指点是
哪里的问题 感激不尽 ><
以下是撷取TableView相关的code
===========
@interface CustomCell : UITableViewCell
@end
@implementation CustomCell
-(id)init
{
self = [super initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:@"cellID"];
return self;
}
@end
===========
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell* c = [[CustomCell alloc]init];
c = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
return c;
}
===========
-(void) viewDidLoad
{
[self.tableView registerClass: [CustomCell class] forCellReuseIdentifier:
@"cellID"];
}