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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:55:15+00:00 2026-06-11T00:55:15+00:00

what I have: a UITableView with a cell. This cell has a UITextView as

  • 0

what I have:

a UITableView with a cell. This cell has a UITextView as a subview. All the delegates and data sources are set correctly. The cell height is obtained correctly from heightForRow etc. The user enters text into the textView.

what I’m trying to do:

I want the cell to update its height as the user types WITHOUT resigning the textView as first responder. Many posts on stackOverflow say that an empty beginUpdates/endUpdates works for this.

What I tried:

1- I called beginUpdates and endUpdates (for the tableView) inside textViewDidChange. Nothing happened. (note: all the delegates are set correctly).

2- I even called beginUpdates and endUpdates inside textViewDidEndEditing just to make sure (to see if it works after the textView resigns as first responder). It works (the cell resizes when the textView resigns as firstResponder).

3- I then tried reloadData inside textViewDidChange. It works, except it resigns the textView as first responder (keyboard goes away on every character typed).

4- I then tried reloadData and then directly telling the textView to becomeFirstResponder again (to keep the keyboard up). It works, but this leads to many problems with cursor position and autocorrect and backspace in the textView.

5- I then tried reloadData, and then returning NO in textViewShouldEndEditing when I wanted the keyboard to stay up, but for some reason, the cell would not update its height.

6- Finally, I tried reloadRowsAtIndexPaths etc and then returning NO in textViewShouldEndEditing, but it gave me an error saying it can’t remove an object which refuses to resignFirstResponder.

I also tried methods like reloadInputViews and setNeedsDisplay and setNeedsLayout etc inside textViewDidChange, but nothing happens.

My question:

It seems to me that #2 suggests that a cell cannot update its height while one of its subviews is a firstResponder. Is that the case? Is there any documentation on this (I couldn’t find any)?

Why is beginUpdates/EndUpdates not working? Are there known or common cases where it doesn’t work? Could there be something wrong with the way I’m setting things up? But the resizing works perfectly with #3 and #4 (indicating that all my delegate methods etc are set correctly).

Sorry for the very long question, but can anyone give any ideas besides the ones I posted? I have a feeling that it’s some VERY silly and obvious thing that I’m missing (as usual)…

btw, I’m using both iOS simulator and an actual iPhone with 5.1

  • 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-11T00:55:17+00:00Added an answer on June 11, 2026 at 12:55 am

    It works perfectly in my little demo app. Note that the code gets the textView delegate message, sets an ivar height which is applied to every cell, then calls begin/end – the cells all get bigger on each character press:

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    NSLog(@"Asked for Height");
        return height;
    }
    - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
    {
        NSLog(@"Text");
        height += 10;
        [self.tableView beginUpdates];
        [self.tableView endUpdates];
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a popover that contains a UITableView. This UITableView has a cell with
I have a custom UITableView cell that has a UIImageView sized to the width
I have a custom UITableView cell which has a button and a label. I
I have a uitableview 'A' which has cells, on clicking one of the cell,
I have TableCellViewController for managing cells in my UITableView. Each cell has a label
I have a UITableView and a UITableCell subclass. Each table cell has two scrollviews
I have an UITableview which has a description cell populated by an NSString ,
I have a UITableView which displays images. Every cell has an image and every
Similar to this question I have a custom subclass of UITableViewCell that has a
I have custom UITableViewCell . It contains UITextLabel . When I press this cell

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.