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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:07:16+00:00 2026-06-07T23:07:16+00:00

I have a tableview with multiple prototype cells that i designed in the storyboard,

  • 0

I have a tableview with multiple prototype cells that i designed in the storyboard, but i´m stuck with the height problem because my first cell is supose to be different from the second one and so on…I have different identifiers for each cell, and because i designed them in storyboard, i know they´re height´s. I have this in my code, but it´s not working, does anyone knows how to fix it?:

-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell = [[UITableViewCell alloc]init];
switch (indexPath.section) 

{
    case 1:

        cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        return 743.0f; 

        break;

    case 2:

        cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];
        return 300.0f;



}

}

Thanks for your time.

  • 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-07T23:07:18+00:00Added an answer on June 7, 2026 at 11:07 pm

    It looks like you are trying to use this method for purposes it wasn’t designed for…
    you’ll want to override the method:

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        switch (indexPath.section)
            case 1:
               static NSString *CellIdentifier = @"cell1";
               break;
            case 2:
               static NSString *CellIdentifier = @"cell2";
               break;
    
        UITableViewCell *cell = [tableView 
          dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) 
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }
    
        // Configure the cell...
        return cell;
    }
    

    Only change the row height in the heightForRowAtIndexPath:

    -(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
    switch (indexPath.section) 
    
    {
        case 1:
    
            return 743.0f; 
    
            break; //technically never used
    
        case 2:
    
            return 300.0f;
    
    
    
    }
    

    Check out this tutorial http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1 its a good resource

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

Sidebar

Related Questions

Using storyboard, I have a table view controller containing multiple dynamic prototype cells. One
I have a Tableview containing cells with images, however the cells that are reused
I have added multiple labels in My Tableview cell. I am displaying facebook message
I have a string containing multiple values from a tableview cell,the string maybe multiple
I have a problem using iOS 5 new functionality to select multiple cells during
I have a tableview with multiple dynamic tableview cells, and inside each tableviewcell i
I am putting together a TableView and I need to have multiple cell classes
I'm using a tableview with sections and multiple selection, but I have an issue
I have a tableView that present a list of Books, each of the table
I have a TableView with 10 sections that are loaded from a plist file

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.