Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:32:58+00:00 2026-06-05T11:32:58+00:00

I have an NSDictionary that we will say is like this: key: value: name

  • 0

I have an NSDictionary that we will say is like this:

key:       value:
name       Bookshelf
movies     Array containing: (Movie 1, Movie 2, Movie 3)
books      Array containing: (Book 1, Book 2, Book 3)
music      Array containing: (Music 1, Music 2, Music 3)

And so on. Now what I’m trying to do is create a tableView that displays all this information, but with different types of cells based on what the dictionary key is. For example, movies use cellForMovies books use cellForBooks music use cellForMusic, each has it’s own layout.

Obviously, I am oversimplifying, but hopefully you understand what I’m trying to do.

I am able to accomplish this if I do sections and a different cell type for each section, but I don’t want to do that. I want to be able to have a table like this, for example:

cellForBooks
cellForMovies
cellForMovies
cellForMusic
cellForBooks

and so on…Any ideas or resources you can point me to? I only care about iOS 5 support (storyboards).

Edit with solution:

A big thank you to everyone who helped, especially atticus who put the final piece together.

What ended up working was to change the structure of the data to be an array of dictionaries and then add a Key: type Value: book/movie/music to each entry. The data structure now looks like:

Array[0]: Dictionary: [Key: type Value: book], [Key: name Value: Physics];
Array[1]: Dictionary: [Key: type Value: music], [Key: name Value: Rock];

Then to configure the cells I did this:

NSString *CellIdentifier = @"Cell";
NSDictionary *object = [self.listOfStuff objectAtIndex:indexPath.row];
if ([[object objectForKey:@"type"] isEqualToString:@"book"]){
    CellIdentifier = @"BookCell";
}else if ([[object objectForKey:@"type"] isEqualToString:@"music"]){
    CellIdentifier = @"MusicCell";
}else if ([[object objectForKey:@"type"] isEqualToString:@"movie"]){
    CellIdentifier = @"MovieCell";
}

each of these had a different tableviewcell in the storyboard. We figured out if you want to use any of the built-in cell features, like cell.textLabel.text you needed to do this:

cell.textLabel.text = [object objectForKey:@"name"];
cell.textLabel.backgroundColor = [UIColor clearColor]; 
cell.textLabel.opaque = NO;

Hope this helps someone else in the future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:32:59+00:00Added an answer on June 5, 2026 at 11:32 am

    A big thank you to everyone who helped, especially atticus who put the final piece together.

    What ended up working was to change the structure of the data to be an array of dictionaries and then add a Key: type Value: book/movie/music to each entry. The data structure now looks like:

    Array[0]: Dictionary: [Key: type Value: book], [Key: name Value: Physics];
    Array[1]: Dictionary: [Key: type Value: music], [Key: name Value: Rock];
    

    Then to configure the cells I did this:

    NSString *CellIdentifier = @"Cell";
    NSDictionary *object = [self.listOfStuff objectAtIndex:indexPath.row];
    if ([[object objectForKey:@"type"] isEqualToString:@"book"]){
        CellIdentifier = @"BookCell";
    }else if ([[object objectForKey:@"type"] isEqualToString:@"music"]){
        CellIdentifier = @"MusicCell";
    }else if ([[object objectForKey:@"type"] isEqualToString:@"movie"]){
        CellIdentifier = @"MovieCell";
    }
    

    each of these had a different tableviewcell in the storyboard. We figured out if you want to use any of the built-in cell features, like cell.textLabel.text you needed to do this:

    cell.textLabel.text = [object objectForKey:@"name"];
    cell.textLabel.backgroundColor = [UIColor clearColor]; 
    cell.textLabel.opaque = NO;
    

    Hope this helps someone else in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the question explains it all. For instance, if I have a NSDictionary like this
i have another problem this time, i'm fetching json codes that will be used
I have a NSDictionary that I get from a webservice. Each object in this
I have made this so far. It's code that will make a json String
I have an NSDictionary that holds all the data: One title (not important for
I have a simple NSDictionary that I am trying to populate with data from
i have a NSDictionary of this type : ********** = ( 20110330 7Huge Sandstorm
I have this NSDictionary: Categorys = { Category = ( { categoryDescription = {
I have an NSDictionary object that is populated by instances of NSMutableString for its
I have a couple UIViewControllers that I am trying to access an array inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.