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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:47:17+00:00 2026-05-31T21:47:17+00:00

I got an iOS app with table view. When i select rows several times,

  • 0

I got an iOS app with table view. When i select rows several times, information in selected one duplicate.

You can see it on a picture:
enter image description here

I add cell’s in this way:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    // Configure the cell...
    UILabel *label = [[UILabel alloc] init];
    Place *item = [source objectAtIndex:indexPath.row];
    [label setFont:[UIFont fontWithName:@"PermianSansTypeface" size:15.0]];
    label.text =item.name;
    label.frame = CGRectMake(5, 5, 310, 35);
    [cell addSubview:label];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    OnePlaceViewController *placeView = [[OnePlaceViewController alloc] initWithNibName:@"OnePlaceViewController" bundle:nil];
    placeView.nom = indexPath.row;
    placeView.source = source;
    placeView.route = route;
    placeView.titleView = titleView;
    /*
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.selected = NO;
    */
    [self.navigationController pushViewController:placeView animated:YES];
}

Why do information duplicate? Thnx.

  • 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-31T21:47:18+00:00Added an answer on May 31, 2026 at 9:47 pm

    I think the problem is that you’re adding UILabel as subView everytime. Since cells are reused, everytime the table reloads, multiple UILabels are added. So, my suggestion would be to go through all the subviews of the cell and remove them before adding new label.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    // Configure the cell...
    UILabel *label = [[UILabel alloc] init];
    Place *item = [source objectAtIndex:indexPath.row];
    [label setFont:[UIFont fontWithName:@"PermianSansTypeface" size:15.0]];
    label.text =item.name;
    label.frame = CGRectMake(5, 5, 310, 35);
    for(UIView *v in [cell subviews])
    {
        if([v isKindOfClass:[UILabel class]])
           [v removeFromSuperview];
    }
    [cell addSubview:label];
    return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an iOS app that at one point opens a link to a
I've got an app that worked OK in iOS 4 but is having several
I've got an iOS app that allows a user to connect to our server
I got an ios app, where i want show content on some pages, like
I got an iOS app. All data stores in xml files. <?xml version=1.0 encoding=utf-8?>
I've got my iOS app sending out emails, where it generates the email form
I got ios app. I need to store some data. I tried to do
I got an ios app with some data, which store in .xml files. There
Today I submit my iOS App to app store, but soon I got a
I'm going to implement a view similar to the original photo app in iOS.

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.