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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:39:08+00:00 2026-05-11T12:39:08+00:00

I’ve got a custom UITableViewCell implementation (leveraging labels as subviews) that is rendering the

  • 0

I’ve got a custom UITableViewCell implementation (leveraging labels as subviews) that is rendering the list of items correctly, but when I scroll down and select an item (say number 43 of 100), I see a rendering of a cell from earlier in the list (from say, number 3 on the first render page in the table) appear on top of the cell I selected.

Here is my method:

    - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {     static NSString *CellIdentifier = @'Cell';      UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:CellIdentifier];     if (cell == nil) {         cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];     }     // index of table view correlates to index of array     Card *card = [cards objectAtIndex:indexPath.row];      UILabel *cardNameLbl = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 3.0, 200.0, 18.0)] autorelease];     cardNameLbl.tag = CARD_NAME_TAG;         cardNameLbl.text = card.name;     cardNameLbl.font = [UIFont systemFontOfSize:12.0];     cardNameLbl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;     [cell.contentView addSubview:cardNameLbl];      UILabel *cardNumLbl = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 21.0, 100.0, 18.0)] autorelease];         cardNumLbl.tag = CARD_NUM_TAG;     cardNumLbl.text = card.number;     cardNumLbl.font = [UIFont systemFontOfSize:12.0];     cardNumLbl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;      [cell.contentView addSubview:cardNumLbl];      UILabel *cardTypeLbl = [[[UILabel alloc] initWithFrame:CGRectMake(110.0, 21.0, 200.0, 18.0)] autorelease];       cardTypeLbl.tag = CARD_TYPE_TAG;     cardTypeLbl.text = card.type;     cardTypeLbl.font = [UIFont systemFontOfSize:12.0];     cardTypeLbl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;         [cell.contentView addSubview:cardTypeLbl];      UILabel *cardQuantityLbl = [[[UILabel alloc] initWithFrame:CGRectMake(250.0, 3.0, 50.0, 18.0)] autorelease];         cardQuantityLbl.tag = CARD_QUANTITY_TAG;     cardQuantityLbl.text = [NSString stringWithFormat:@'%d', card.have];     cardQuantityLbl.font = [UIFont systemFontOfSize:12.0];     cardQuantityLbl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;     [cell.contentView addSubview:cardQuantityLbl];      return cell; } 
  • 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. 2026-05-11T12:39:09+00:00Added an answer on May 11, 2026 at 12:39 pm

    Generally, these kinds of errors (seeing data from one row in another) indicates that you’re not setting the parts of your reusable cells, so it’s just using old data, but I can’t find any part that isn’t being reset.

    One thing that you should definitely do however, and that might actually fix this problem, is subclass UITableViewCell, which maintains those labels as ivars. Then you can initialize the labels and add them as subviews once, in the init method, or wherever else you choose.

    What’s currently happening is: each time you grab a reusable cell, it potentially already has those labels on it from before, and you’re just piling more subviews on top of subviews. (Unless I’m mistaken and a reusable cell has its subviews cleared out before it is returned.)

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

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have found that, there are no ports of mysql-client… May 12, 2026 at 11:04 pm
  • Editorial Team
    Editorial Team added an answer I think this is what your looking for: http://geekswithblogs.net/mahesh/archive/2006/06/27/83264.aspx The… May 12, 2026 at 11:04 pm
  • Editorial Team
    Editorial Team added an answer It looks like under IE8 the keyCode property of window.Event… May 12, 2026 at 11:04 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS
I want use html5's new tag to play a wav file (currently only supported

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.