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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:08:29+00:00 2026-06-03T12:08:29+00:00

I have 4 sections in my tableview, and when a row is pressed i

  • 0

I have 4 sections in my tableview, and when a row is pressed i want a checkmark to be added to that row. With the code below, if i select a row, some of the other rows also get checked, which is not desired. I’m guessing it has something to do with the several sections, but i don’t know how to check for that or fix it. My _allTagsList is a NSMutableArray with 4 dictionaries.

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     NSDictionary *dictionary = [_allTagsList objectAtIndex:indexPath.section];
     NSArray *array = [dictionary objectForKey:@"Tags"];
     NSString *selectedTag = [array objectAtIndex:indexPath.row];


     if([tableView cellForRowAtIndexPath:indexPath].accessoryType == UITableViewCellAccessoryCheckmark)
     {
         [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
     }
     else
     {
         [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
     }

     [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
  • 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-03T12:08:34+00:00Added an answer on June 3, 2026 at 12:08 pm

    You need to store which indexPaths are selected and then in your cellForRowAtIndexPath function you need t also set the accessoryType based on those saved indexPaths. If you change the accessoryType on a cell and then scroll, as that cell gets recycled the accessoryType will stil remain checked.

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

Sidebar

Related Questions

I have a button that when pressed, a tableview section will be added and
I have a UITableView that I have set-up with 2 sections. The code below
I have a tableview with four sections first section has 7 rows in that
I have a tableview with 2 sections. Section 1 has 1 row Section 2
I have a tableView with multiple sections. When a sections contains only one row,
I have a UITableViewController (called Details). In that tableView on row 1 I have
I want to create a tableview like this. All sections have custom section header
I have the following code in my search method that updates the tableview. for
i have a grouped tableview which contains 3 sections,i want to add different buttons
I have some problems with UITableView and sections/rows. Iam parsing the section names, all

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.