-1
我想添加一個UITableView
,其中有兩種類型的自定義UITableViewCell
。 其中一個單元格應該包含UITableView
與其他自定義單元格H.這是我的代碼爲UITableViewCell
的外觀,我在其中添加了另一個UITableView
。我們可以將UITableView添加到自定義UITableViewcell中嗎?
#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
你應該考慮重新設計結構。在另一個裏面使用UITableView並不是一個好設計。或者,您可以在預期內容的單元上點擊另一個UITableViewController。 – ZeMoon 2015-03-31 05:26:58
是的,你可以。我做了很多次。 – atulkhatri 2015-03-31 05:44:21