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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:26:31+00:00 2026-05-18T02:26:31+00:00

Into the cellForRowAtIndexPath: method of an UITableViewController class I am using the next code

  • 0

Into the cellForRowAtIndexPath: method of an UITableViewController class I am using the next code to show a cell that contains an UITextView.

Sometimes when I scroll the table that contains the cell and then I scroll the cell UITextView, it shows the cell text reprinted (as if there were two UITextView objects, instead of one, into the cell).

What can I do to solve this problem?

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];    
if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

cell.contentView.bounds = CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height);
cell.selectionStyle = UITableViewCellSelectionStyleNone;

UITextView *textView = [[UITextView alloc] initWithFrame:cell.contentView.bounds];
                textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
textView.editable = NO;
textView.scrollEnabled = YES;
textView.backgroundColor = [UIColor clearColor];
textView.font = [UIFont fontWithName:@"Helvetica" size:14.0];
textView.text = self.description;

[cell.contentView addSubview:textView];
[textView release];
  • 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-18T02:26:32+00:00Added an answer on May 18, 2026 at 2:26 am

    UITableView reuses its cells to increase scrolling performance. Whenever a cell is being reused, you are adding a new text view to the cell (although one is already there).

    You should move the creation of the text view (and adding it to the cell) into the if (cell == nil) block. Inside this block, also give the text view a unique tag and use this tag property to access the text view from outside the block. See Apple’s table view sample code for examples of this pattern, it is being used a lot.

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

Sidebar

Related Questions

I have the following method that loads cells into my table. The cell with
I inserted this gradient coce into my cellForRowAtIndexPath method, but it does weird things.
App crashes after execution of cellForRowAtIndexPath method of tableView It goes into: UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:]
Into a class constructor, I need to create some objects on the fly and
Looking into org.pentaho.reporting.engine.classic.core.DataFactory and more specifically into the initialize method (which was formerly part
Logged into my Windows XP SP2 computer using my normal user account (which has
I am having some trouble with UITableView's reloadData method. I have found that it
I'm having trouble sending data to a different view using the prepareForSegue method… I
I have a simple predicate function that follows as: [totalSentences addObjectsFromArray:[firstLangEx filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@(SELF contains[c]
I have a UITableView that I want updated by a method called by a

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.