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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:24:03+00:00 2026-06-10T21:24:03+00:00

I have a UITableViewCell that I need to resize as the user types. The

  • 0

I have a UITableViewCell that I need to resize as the user types. The cell has a UITextView as a subview.

Inside heightForRowAtIndexPath, I need to check whether the current cell is nil or initialized.

If it’s nil, I calculate its height based on text in a string property.

If it’s NOT nil (i.e. initialized), I want it to retrieve the text property of the cell’s subview (I know I can access it if the cell is initialized).

How can I check if a UITableViewCell is nil or not within heightForRowAtIndexPath:? I tried

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([overviewTableView cellForRowAtIndexPath:indexPath] !=nil)
    {    NSLog(@"YEEHAW!");
    }
}

but it results in an error (probably because cellForRowAtIndexPath: expects the cell to be initialized, not nil). Also, I noticed that cellForRowAtIndexPath: calls heightForRowAtIndexPath: (resulting in a recursive loop).

I’ve seen many “alternatives” on the web, but I was just wondering whether this approach is would work (or is valid at all).

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-06-10T21:24:04+00:00Added an answer on June 10, 2026 at 9:24 pm

    You could check if the indexPath for the cell of interest is visible or not:

    if ([[overviewTableView indexPathsForVisibleRows] containsObject:indexPath])
    {
        //Do something here
    }
    

    Hope this helps!

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

Sidebar

Related Questions

Similar to this question I have a custom subclass of UITableViewCell that has a
I have a class A that inherits UITableViewCell (to customize a table cell). It
i need two kinds of UITableViewCell that has different height: a) One with a
I need help. I have custom uitableviewcell with uiscrollview inside, I iterate over an
I have a custom UITableViewCell that has 2 UITextFields and a UIButton . The
I have a UITableViewCell with a subview consisting of a UITextView. The content of
I have a class that subclasses UITableViewCell. I need to initialize some of the
Let's say I have 10 tableViews that all need to have the first cell's
I have a UITableViewCell that contains a UIScrollView . The UIScrollView contains a different
I have a custom UITableViewCell that seems to appear multiple times on my table

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.