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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:38:01+00:00 2026-05-18T00:38:01+00:00

I have a UITableViewCell that has an integrated UITextView. The goal is to make

  • 0

I have a UITableViewCell that has an integrated UITextView. The goal is to make a cell that auto-expands while editing. The issue right now is that when the UITableViewController sends setEditing:YES, the UITextView scrolls and clips some of the text at the top.

I’m sure there is a better way to do this but I just don’t know how…

#import "PLTextViewCell.h"

@implementation PLTextViewCell

@synthesize delegate=_delegate;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
        _textView = [[UITextView alloc] initWithFrame:CGRectMake(90, 0, 200, 80)];
        [_textView setEditable:NO];
        [_textView setFont:[UIFont systemFontOfSize:15.0]];
        [_textView setDelegate:self];
        [_textView setScrollEnabled:NO];
        [[self contentView] addSubview:_textView];
    }
    return self;
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
    [_textView setEditable:editing];
    [_textView scrollRangeToVisible:NSMakeRange(0, 1)];
    [self textViewDidChange:_textView];
}

- (void)dealloc {
    [_textView dealloc];
    [super dealloc];
}

- (void)setTextValue:(NSString *)value {
    [_textView setText:value];
    [self textViewDidChange:_textView];
}

- (NSString *)textValue {
    return [_textView text];
}

- (CGFloat)cellHeight {
    CGSize mySize = [_textView contentSize];
    NSLog(@"cell height: %f", mySize.height);
    return mySize.height;
}

#pragma mark -
#pragma mark Text view delegate

- (void)textViewDidChange:(UITextView *)textView {
    CGSize mySize = [_textView contentSize];
    if (mySize.height > self.bounds.size.height) {
        [textView scrollRectToVisible:CGRectMake(0,textView.contentSize.height-1,1,1) animated:NO];
        if ([self delegate] != nil) {
            [[self delegate] tableViewCellDidChangeHeight:self];
        }
        [textView setFrame:CGRectMake(90, 0, mySize.width, mySize.height)];
        [self setNeedsLayout];
    }
}

@end

Then the Table view implements a delegation method:

- (void)tableViewCellDidChangeHeight:(PLTextViewCell *)cell {
    [self.tableView beginUpdates];
    [self.tableView endUpdates];
}

Any ideas? Am I doing this all wrong?

  • 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-18T00:38:02+00:00Added an answer on May 18, 2026 at 12:38 am

    Turns out that it was the UIEdgeInset combined with my textview not being tall enough. My mistake!

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

Sidebar

Related Questions

No related questions found

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.