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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:53:56+00:00 2026-06-13T20:53:56+00:00

Okay so I am slowly figuring this out. Just one more issue I am

  • 0

Okay so I am slowly figuring this out. Just one more issue I am having. I am using a string and saying that if the string is equal to the cell text to put a checkmark on it when it loads the tableView.

Here is my code for that:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if ([cell.textLabel.text isEqualToString:transferData]) {

    cell.accessoryType = UITableViewCellAccessoryCheckmark;

}

I am then telling it to remove that checkmark and add the checkmarks accordingly when being selected:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

cell.accessoryType = UITableViewCellAccessoryNone;

  UITableViewCell      *cellCheck = [tableView
                              cellForRowAtIndexPath:indexPath];

cellCheck.accessoryType = UITableViewCellAccessoryCheckmark;

  transferData = cellCheck.textLabel.text;
  NSLog(@"%@", transferData);
}


- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell* uncheckCell = [tableView
                                cellForRowAtIndexPath:indexPath];
uncheckCell.accessoryType = UITableViewCellAccessoryNone;

}

Everything works fine, except when it first loads. For some reason when I select on another cell, the checkmark that is originally loaded with the tableView won’t go away. Why is this?

  • 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-06-13T20:53:58+00:00Added an answer on June 13, 2026 at 8:53 pm

    You are making a common mistake.

    When selecting the cell, you are setting the state of the check mark directly. What you should be doing is setting the state of the checkmark in the data source and let the table cell configure itself from the data source.

    Edited example for an exclusive checked table view

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        NSArray *changedIndexPaths = nil;
    
        NSIndexPath *currentCheckedIndexPath = [self indexPathOfCurrentCheckedObject];
    
        if (currentCheckedIndexPath && ![currentCheckedIndexPath isEqual:indexPath]) {
            // There is currently a checked index path - unselect the data source and
            // add it to the changed index array.
    
            [[self.tableData objectAtIndex:currentCheckedIndexPath.row] setChecked:NO];
            changedIndexPaths = @[indexPath, currentCheckedIndexPath];
        } else{
            changedIndexPaths = @[indexPath];
        }
    
        [[self.tableData objectAtIndex:indexPath.row] setChecked:YES];
    
        [self.tableView reloadRowsAtIndexPaths:changedIndexPaths withRowAnimation:UITableViewRowAnimationNone];
    
    }
    

    I have a new sample app you can download to see the whole project:

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

Sidebar

Related Questions

Okay so I can't figure this out. Like a file that I using grep
Okay, next PHPExcel question. I have an HTML form that users fill out and
Okay, I feel a bit foolish for having to ask this but I guess
Okay, this is probably a very basic question; but, I'm just getting back in
Okay I do apologise that I'm out of my depth here. I'm not the
Okay, so this is the line that's returning null. What am I doing wrong
I'm hoping maybe this is just an issue with the simulator but of course
Okay, this one is pretty obvious to everyone who use Django and frequently asked
Okay, I kinda asked this question already, but noticed that i might have not
Okay. I know this looks like the typical Why didn't he just Google it

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.