Add custom Cell to JKExpandtableview as Child Cell in iOS

◇◆丶佛笑我妖孽 提交于 2019-11-30 20:01:53

问题


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

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


回答1:


Please go to the following link. The creator himself answered the question https://github.com/jackkwok/JKExpandTableView/issues/5

jackkwok commented on 9 Aug 2014 Hi Bruno, Thanks! You may need to subclass both of them. What kind of customizations do you want to do?




回答2:


JKExpandTableView is a subclass of UITableView.

You must implement delegate of UITableView.

ex)

Example class

@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

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;  
}


来源:https://stackoverflow.com/questions/26071132/add-custom-cell-to-jkexpandtableview-as-child-cell-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!