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

  • SEARCH
  • Home
  • 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 6852419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:05+00:00 2026-05-27T01:22:05+00:00

I have a table view that I want 3 different custom cells in it,

  • 0

I have a table view that I want 3 different custom cells in it, right now this code only has one.

How can I modify my code so that case 2 and case 9 both have their own custom table cells with their own cell identifiers? Keep in mind this code is inside an if/else statement because I have 2 different tableviews in my VC.

static NSString *CellIdentifier = nil;

    if (tableView == self.mytableview)
    {
    }
    else if (tableView == self.vitalsTableView)
    {
            CellIdentifier = @"textCell";
            VitalsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            switch (indexPath.row) {
                case 0:
                    cell.vitalsLabel.text = @"Temperature";
                    break;
                case 1:
                    cell.vitalsLabel.text = @"Pulse";
                    break;
                case 2:
                    cell.vitalsLabel.text = @"Blood Pressure";
                    break;
                case 3:
                    cell.vitalsLabel.text = @"Respiratory Rate";
                    break;
                case 9:
                    cell.vitalsLabel.text = @"Smoking Status";
                    break;
                default:
                    break;
            }
            return cell;
    }
  • 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-05-27T01:22:06+00:00Added an answer on May 27, 2026 at 1:22 am

    It would be something like you already have but with a minor modification of the class you modify and the identifiers, I hope I got what you were asking.

    static NSString *CellIdentifier = nil;
    
    if (tableView == self.mytableview)
    {
    }
    else if (tableView == self.vitalsTableView)
    {
        if ([indexPath row] == 2 || [indexPath row] == 9) {
            CellIdentifier = @"Cell2Or9";
            Cell2or9 *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            switch (indexPath.row) {
                case 2:
                    cell.vitalsLabel.text = @"Blood Pressure";
                    break;
                case 9:
                    cell.vitalsLabel.text = @"Smoking Status";
                    break;
                default:
                    break;
            }
        }
        else{
            CellIdentifier = @"CellNot2Or9";
            CellNot2or9 *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            switch (indexPath.row) {
                case 0:
                    cell.vitalsLabel.text = @"Temperature";
                    break;
                case 1:
                    cell.vitalsLabel.text = @"Pulse";
                    break;
                case 3:
                    cell.vitalsLabel.text = @"Respiratory Rate";
                    break;
                default:
                    break;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table view. in that one row is having different lines for
On each cell of my table view I want to have a bar that
I have a Pages table that stores all my view urls and this table
I have different number of photos in tableview custom cell.Now i want to display
I want to have a table view that is blank at start. The user
I have a view based table with a custom cell view. Inside this custom
I have a table view that I am customizing and I am adding a
I have a table view that is managed by an NSFetchedResultsController. I am having
I have an MVC application view that is generating quite a large HTML table
I have a self referencing table in Oracle 9i, and a view that gets

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.