我们可以将 UITableView 添加到 Custom UITableViewcell 中吗?
Can we add UITableView into Custom UITableViewcell?
我想添加一个 UITableView
,其中有两种类型的自定义 UITableViewCell
。
其中一个单元格应包含 UITableView
和其他自定义单元格 H。这就是我的 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
是的,您可以在 UITableViewCell
-
上添加 UITableView
有关同一内容的更多信息,请参阅下文 link-
Is it possible to add UITableView within a UITableViewCell
我想添加一个 UITableView
,其中有两种类型的自定义 UITableViewCell
。
其中一个单元格应包含 UITableView
和其他自定义单元格 H。这就是我的 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
是的,您可以在 UITableViewCell
-
UITableView
有关同一内容的更多信息,请参阅下文 link-
Is it possible to add UITableView within a UITableViewCell