I have a tableView
of music albums. For each cell
of tableView
I'd like to display the music album cover art and also the list of music tracks of the corresponding album.
So basically, in each music albums UITableViewCell
there will be the music album cover art on the top half, and a UITableView
on the bottom half.
UITableViewCell
example:
I'm as far as adding the music album cover art on the top half, and a blank UITableView
on the bottom half.
- (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;
}
I can't figure out inside cellForIndexPath
how to fill in the UITableView
of songs. I'm just trying to use a static textLabel.text
right now, even though I'll eventually fill it in via the actual NSArray
of songs.
I know this is a confusing thing to do, and stylistically it wouldn't make sense in most cases, but is there anyone that knows how this can be done?
You should use sections. Each section header should display album cover and each cell in section should display the song name. Don't add a table view inside cell view...
in numberOfSections
method return the number of albums, inside the viewForHeaderInSection
add album cover, and in cellForRow...
check which section is and display song name....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.