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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:58:11+00:00 2026-05-25T11:58:11+00:00

I need some help for my problem. I’ve seen a lot of similar posts,

  • 0

I need some help for my problem. I’ve seen a lot of similar posts, and tried solutions, but none of them have worked for me.

I have a custom UITableViewCell in which I have multiple UILabel and a UIButton control. This control is suppose to update one of the labels from its cell. However, instead of updating the correct UILabel it updates the UILabel in the last cell.

My code :

- (UITableViewCell *)tableView:(UITableView *)inTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSInteger ETag = 111;
  static NSInteger STag = 112;

  .... // code

  if (cell == nil) {

  .... // code

   frame.origin.x = 85;
    frame.origin.y = 10;
    frame.size.height = 50;
    frame.size.width = 100;

    SLabel = [[UILabel alloc] initWithFrame:frame];
    SLabel.tag = STag;
    [cell.backgroundView addSubview:SLabel];
    //[SLabel release];

    frame.origin.x = 215;
    frame.origin.y = 10;
    frame.size.height = 50;
    frame.size.width = 100;

    ELabel = [[UILabel alloc] initWithFrame:frame];
    ELabel.tag = ETag;
    [cell.backgroundView addSubview:ELabel];
    //[ELabel release];

   .... // code

   }

   .... // code

    ELabel = (UILabel *) [cell.backgroundView viewWithTag:ETag];
    SLabel = (UILabel *) [cell.backgroundView viewWithTag:STag];

    ELabel.text = [s._episode stringValue];
    ELabel.backgroundColor = [UIColor clearColor];
    ELabel.textColor = [UIColor whiteColor];
    ELabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
    ELabel.textAlignment = UITextAlignmentLeft;
    ELabel.tag = 1000+indexPath.row;

    SLabel.text = [s._season stringValue];
    SLabel.backgroundColor = [UIColor clearColor];
    SLabel.textColor = [UIColor whiteColor];
    SLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
    SLabel.textAlignment = UITextAlignmentLeft;
    SLabel.tag = 1000+indexPath.row;
    ..... // code

    return cell;
    }

Thanks for reading and helping me.

Tommy

Thank you ! i resolved my problem with :

 UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];            
 UILabel *a = (UILabel *) [cell viewWithTag:(1000+indexPath.row)]; 
 a.text = [NSString stringWithFormat:@"%@", @"something"]; 

the issue was that tags were not unique

  • 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-25T11:58:11+00:00Added an answer on May 25, 2026 at 11:58 am

    You access needful UILabel via its tag, if it is unique in your view.
    For example, you have UITableView with multiple cells. Each cell contains UILabel that might be updated. Let’s set unique tags for that labels, let them be your indexPath.row of UITableViewCell (it is already done in your code).

    Then when you want to update some cell with tag == cellsTagToUpdate you should just get reference to that cell via call to UITableView *tableView: UILabel *labelToUpdate = [tableView viewWithTag:cellsTagToUpdate].

    Now you have reference to your label that you want to update. Before updating you should check if cell is not nil. It would be nil if that view (UILabel) is not now visible and was removed from superview.

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

Sidebar

Related Questions

I have a problem that I need some help on but I feel I'm
I need some help in solving this problem. We have a large amount of
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have
I have a minor problem guys which I need some help. I have a
I ran into a little problem and need some help: If I have an
I have a problem and need some help. My application uses outlook to send
The solution to this problem is probably pretty simple, but I need some help.
i have a litte problem and i need some help :) For example i
I need some help on this problem. It is about ASP.NET MVC3. I have
I have this strange problem I need some help with. This menu code goes

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.