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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:52:36+00:00 2026-06-06T18:52:36+00:00

I have built three different cells in my storyboard and hooked all the outlets

  • 0

I have built three different cells in my storyboard and hooked all the outlets up, each cell has a unique identifier.

For example I have one cell which holds a picture, another which has a label and another with other contents, so they are all unique and each cell type requires its own height (dynamic or status, it doesn’t matter).

However, how is it that I can make a cell with ‘indentifier1’ return a certain height and then the others cells returns different heights?

I know I can use - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath but I am unsure how to differentiate the cells.

I am using core data and fetch results for the tableview from that.

Edit

I have tried this with tags but its crashes at the first if statement:

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

    if ([[tableView cellForRowAtIndexPath:indexPath] tag] == 1) cellHeight = 170;
    else if ([[tableView cellForRowAtIndexPath:indexPath] tag] == 2) cellHeight = 100;
    else if ([[tableView cellForRowAtIndexPath:indexPath] tag] == 3) cellHeight = 140;

    return cellHeight;
}
  • 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-06T18:52:38+00:00Added an answer on June 6, 2026 at 6:52 pm

    of course it crashed, because you are in a delegate method, (you are a delegate of the UITableView) and from such method calling back the UITableView methods takes very high risk of crash.

    the method ([tableView cellForRowAtIndexPath:indexPath]), what you call, will call a delegate method again for the cell’s height, and it causes an infinite loop, aka crash.

    this is normal behaviour.

    the key is in your original data source, you could store the height for each row in the original data source, and you can read everything back from there, in your delegate methods without any risk.

    your code fragment does not say where your data source is and what kind of your data source is, thus I cannot give more exact solution in lack of it, but the idea would be that.

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

Sidebar

Related Questions

I have built a layout that can display a picture on three different areas.
I have three files: lib.c lib.h => They should be built as a .so
I have a domain service specifically built for LightSwitch where I defined three entities.
I have built a couple of simple functions which return cell values in Google
Assume I have three build configurations Build and Run Tests QA Build Production Build
I have a Maven build with three modules. Module A exports a jar. Module
Does Java have a built-in Antivirus? One of my friends told me there is
I have a VB project which I'm trying to configure with three build configurations.
I have a deep tree structure built with lists, containing lists and floats. I
We have a system built on seam/richfaces. There's this webpage where the tables are

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.