在iOS中将自定义Cell添加到JKExpandtableview作为Child Cell [英] Add custom Cell to JKExpandtableview as Child Cell in iOS

查看:80
本文介绍了在iOS中将自定义Cell添加到JKExpandtableview作为Child Cell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直面临在 JKExpandableTableView 中添加自定义单元格的问题,我如何在孩子时添加自定义单元格,任何帮助都将不胜感激,谢谢。

I've been facing problem to add custom cell in JKExpandableTableView ,How Can I add Custom Cell as a child,Any Help will be appreciated ,Thanks.

对不起我的英文。
我想实现输出,如

Sorry for my english. I'd like to achieve output like

注意:我正在使用此库 JKExpandableTableView 所有内容工作正常。

Note: I'm using this Library JKExpandableTableView everything is working fine.

推荐答案

JKExpandTableView 是<$ c的子类$ c> 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的委托。

You implement delegate for 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;  
}

这篇关于在iOS中将自定义Cell添加到JKExpandtableview作为Child Cell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆