Add custom Cell to JKExpandtableview as Child Cell in iOS

风流意气都作罢 提交于 2019-12-01 00:56:57
Nabeel Ahmed

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?

darkdongdong

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