在iOS中将自定义Cell添加到JKExpandtableview中作为Child Cell
我一直在面对问题添加自定义单元格JKExpandableTableView ,如何添加自定义单元格作为一个孩子,任何帮助将不胜感激,谢谢。
对不起我的英语不好。 我想实现输出
注意:我正在使用这个库JKExpandableTableView一切工作正常。
请转到以下链接。 创造者自己回答了这个问题https://github.com/jackkwok/JKExpandTableView/issues/5
jackkwok评论于2014年8月9日Hi Bruno,谢谢! 你可能需要子类化它们。 你想做什么样的定制?
JKExpandTableView
是UITableView
一个子类。
你必须实现UITableView
委托。
EX)
示例类
@interface CustomCell : UITableViewCell @end` @implementation CustomCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self.contentView setBackgroundColor:[UIColor redColor]]; } return self; } @end
你实现了CustomCell的委托。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifierCell = @"CustomCell"; CustomCell *cell = (CustomCell *)[tableview dequeueReusableCellWithIdentifier:identifierCell]; if(cell == nil) { cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:invitationCell]; } return cell; }