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 5939961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:54:06+00:00 2026-05-22T15:54:06+00:00

Hey everybody, I’m very confused about how to use two different Cell Types in

  • 0

Hey everybody, I’m very confused about how to use two different Cell Types in one UITableView with two sections. The first section should return a large Cell, with a lot of text, the other section should return three cells, to navigate to other Views. I tried it like this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //NSUInteger section;
    static NSString *CellIdentifier1 = @"CellIdentifier";
    static NSString *CellIdentifier2 = @"Cell";

    if (indexPath.section == 0) {

        CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
        if (cell == nil)
        {
            [[NSBundle mainBundle] loadNibNamed:@"CustomTableCell" owner:self options:nil];     cell = [self customTableCell];
            [self setCustomTableCell:nil];
        }
        return cell;
    }
    else if (indexPath.section == 1) {

            cTableViewCell *cell = (cTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
            if (cell == nil)
            {
                [[NSBundle mainBundle] loadNibNamed:@"cTableViewCell" owner:self options:nil];
                cell = [[cTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier2];
                [self setCustomTableCell:nil];
            }
            // Configure the cell...
            NSUInteger row = [indexPath row];
            cell.textLabel.text = [array objectAtIndex:row];
            return cell;            
        }
    return cell;
}

I set the height for the cells in the sections here:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger section;
    if (section == 0) {
        return [indexPath row] + 80;
    }
    else 
    {
        return [indexPath row] + 44;
    }

}

I get this Error: ‘cell’ undeclared (first use this function). 🙁 I really hope that you could help me. Thanks in advance

  • 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-22T15:54:06+00:00Added an answer on May 22, 2026 at 3:54 pm

    At the end of tableView:cellForRowAtIndexPath:, make it return nil; instead of return cell;.

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

Sidebar

Related Questions

Hey so what I want to do is snag the content for the first
Hey everybody, i am deploying my code from a cluster running on ubuntu onto
Hey everybody, I was wondering where, or what is the methods used in the
Hey everybody ! I am a beginner programmer and need some help with pointers.
Hey everybody. I'm using Edge Side Includes on Varnish to cache a static HTML
Hey everybody! When I build this, i get a warning on the objectForKey... the
Hey everybody, I want to create an app that handles some sort of recognition
Hey everybody, I am just newbie at Python. I wanted to write a script
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also

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.