简体   繁体   中英

Add custom Cell to JKExpandtableview as Child Cell in iOS

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.

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM