[英]UITableView inside of UITableViewCell
我有一张音乐专辑的tableView
。 对于tableView
每个cell
,我想显示音乐专辑的封面以及相应专辑的音乐曲目列表。
因此,基本上,在每个音乐专辑UITableViewCell
,上半部分都有音乐专辑封面,而下半部分则是UITableView
。
UITableViewCell
示例:
我要在上半部分添加音乐专辑封面,在下半部分添加空白的UITableView
。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
AlbumsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
MPMediaItem *rowItem = [[albumsArrayForTVC objectAtIndex:indexPath.row] representativeItem];
MPMediaItemArtwork *artwork = [rowItem valueForProperty:MPMediaItemPropertyArtwork];
inputImage = [artwork imageWithSize: CGSizeMake (1024, 1024)];
if (inputImage) {
cell.backgroundImageView.image = inputImage;
} else {
cell.backgroundImageView.image = nil;
}
UITableViewCell *songCell = [cell.songTableView dequeueReusableCellWithIdentifier:@"OtherCell"];
songCell.textLabel.text = @"This text doesn't show up yet";
return cell;
}
我不知道在cellForIndexPath
内部如何填充歌曲的UITableView
。 我现在正试图使用静态textLabel.text
,即使我最终将通过实际的NSArray
歌曲来填充它。
我知道这是一件令人困惑的事情,从风格上说,在大多数情况下这没有意义,但是有人知道如何做到这一点吗?
您应该使用节。 每个部分的标题应显示专辑封面,并且每个部分的单元格应显示歌曲名称。 不要在单元格视图内添加表格视图...
在numberOfSections
方法中返回专辑的数量,在viewForHeaderInSection
内部添加专辑封面,并在cellForRow...
检查哪个部分并显示歌曲名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.