我有一个 tableView
音乐专辑。对于每个cell
的 tableView
我想显示音乐专辑封面以及相应专辑的音乐轨道列表。
基本上,在每张音乐专辑中 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
来填写它歌曲。
我知道这是一件令人困惑的事情,而且在大多数情况下从风格上讲它没有意义,但是有人知道如何做到这一点吗?
最佳答案
您应该使用部分。每个部分标题应显示专辑封面,部分中的每个单元格应显示歌曲名称。不要在单元格 View 中添加表格 View ...
在numberOfSections
方法中返回专辑数量,在viewForHeaderInSection
中添加专辑封面,并在cellForRow...
中检查哪个部分是并显示歌曲名称....
关于ios - UITableViewCell 内部的 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37768934/