繁体   English   中英

我们可以将UITableView添加到自定义UITableViewcell吗?

[英]Can we add UITableView into Custom UITableViewcell?

我想添加一个UITableView在其上有两种类型的Custom UITableViewCell 一个Cell应该包含带有其他自定义Cell H的UITableView 。这就是我的UITableViewCell代码的样子,在上面添加了另一个UITableView

#import "MainDetailsCell.h"
#import "SubCell.h"

static NSString * const     SubCellIdentifier =  @"SubCell";

@implementation MainDetailsCell


- (void)awakeFromNib {
// Initialization code
    [_DetailsTable registerNib:[UINib nibWithNibName:SubCellIdentifier bundle:[NSBundle mainBundle]] forCellReuseIdentifier:SubCellIdentifier];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark  -tableview Methods

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
        return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return UITableViewAutomaticDimension;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *retCell;

    SubCell *cell = [_DetailsTable dequeueReusableCellWithIdentifier:LocationDetailsCellIdentifier forIndexPath:indexPath];

    retCell=cell;

    [retCell setSelectionStyle:UITableViewCellSelectionStyleNone];

    return retCell;
}



@end

是的,你可以添加UITableViewUITableViewCell -

有关相同信息的更多信息,请参见下面的链接-

是否可以在UITableViewCell中添加UITableView

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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