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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:27:15+00:00 2026-06-01T11:27:15+00:00

Brand new poster here on StackOverflow. I’ve been reading and learning here for some

  • 0

Brand new poster here on StackOverflow. I’ve been reading and learning here for some time, but I need to start asking a few questions and interacting, so any help with a few of my issues would be greatly appreciated.

I basically generate a list in a tableView of default sounds from a plist in cellForRowAtIndexPath. This generates me a list of say “x” sounds and one of those sounds has a default checkmark accessory placed on its cell. I have a plist file that stores the ‘active’ sound file’s index value, this is how I put the original checkmark in the generated tableView. So, in the code below, as you can see, I load in the plist’s value for the ‘active’ sounds index, however, when a user interacts with my tableView and they select a new sound, I need the default checkmark placed to be removed from view. Everything else is working fine. I can’t seem to crack this simple problem, Im sure its a simple syntax issue, i just don’t know how to get it done. Im sure the solution is a single line of code or two and its right under my nose. Thank you for help in advance.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
NSDictionary *dictionarySound = [NSDictionary dictionaryWithContentsOfFile:[self ActDataFilePath]];

NSNumber *defaultSoundIndex = [dictionarySound valueForKey:@"soundIndex"];

int theIntVal = [defaultSoundIndex integerValue]; 

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

//Everything below works just fine, checkmarks are removed and placed accordingly, sounds are played just fine.  I just need help above in removing the default checkmark

if(self.checkedPath)
{        
    UITableViewCell *uncheckCell = [tableView cellForRowAtIndexPath:self.checkedPath];

    uncheckCell.accessoryType = UITableViewCellAccessoryNone;
}


cell.accessoryType = UITableViewCellAccessoryCheckmark;

self.checkedPath = indexPath;

……. other code below the plays my sounds on click and stores the newly active sound name and index value in the plist.

  • 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-01T11:27:16+00:00Added an answer on June 1, 2026 at 11:27 am

    Alright boys and girls, here is the solution to my own question.

    The checkmark is determined and placed in cellForRowAtIndexPath initially when the table is built based on my plist file. Here is the code for my cellForRowAtIndexPath that grabs my plist data, builds my table and sets the default selection with a checkmark.

    NSDictionary *dicSound = [NSDictionary dictionaryWithContentsOfFile:[self ActDataFilePath]];
    
    NSNumber *defaultSoundIndex = [dicSound valueForKey:@"soundIndex"];
    
    //conversion of NSNumber to integer for comparison below to indexPath.row, both need to be int's
    int theIntVal = [defaultSoundIndex integerValue];
    
    static NSString *CheckMarkCellIdentifier = @"CheckMarkCellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CheckMarkCellIdentifier];
    
    cell.textLabel.text = [[MyArray objectAtIndex:indexPath.row] objectForKey:@"name"];
    
    if(indexPath.row == theIntVal)
    {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    
    }
    else 
    {
       cell.accessoryType = UITableViewCellAccessoryNone;
    
    }
    
    return cell;
    

    When the user interacts with the tableView by clicking on another cell and didSelectRowAtIndexPath kicks in, this is how Im placing the new checkmark and how Im setting the old cell to have no accessory checkmark.

    //This is a dictionary file that contains a number of values I need to grab
    NSDictionary *dictionarySound = [NSDictionary dictionaryWithContentsOfFile:[self ActDataFilePath]];
    
    NSNumber *defaultSoundIndex = [dictionarySound valueForKey:@"soundIndex"];
    
    //conversion of NSNumber to integer for comparison below to indexPath.row, both need to be int's
    
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];               
    
    if(self.checkedPath)
    {        
        UITableViewCell *uncheckCell = [tableView cellForRowAtIndexPath:self.checkedPath];
    
        uncheckCell.accessoryType = UITableViewCellAccessoryNone;
    }
    
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    
    self.checkedPath = indexPath;
    
    //THE FIX
    [tableView reloadData];
    

    The key here is the [tableView reloadData]; line as it reloads the table with the new options checked and removes the original checkmark. Obviously, Im reloading data which means that I have persistence built in in a plist file. I basically update the local dictionary’s value for ‘soundIndex’ EVERY TIME a user clicks on a cell and then write that to the persistent plist file.

    Hope this helps anyone else who is having this issue.

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

Sidebar

Related Questions

Brand new to coding; been utilizing stackoverflow religiously for months; first time asking a
I'm brand new to Java, programming, and StackOverflow. I need to use a list
I'm not brand new to the concept of unit testing but at the same
I'm brand new to MVC and, as a learning exercise, I'm trying to re-write
I am brand new to the Play framework, but I am trying to use
I'm brand new to C, and I need to ask the user to type
I am a brand new Java developer (I have been working in asp.net) and
First off I am brand new to C and have been thrown into a
I'm brand new to Eclipse (learning Python). I'm really confused about the terminology within
First I'm brand new to JS but have an idea that object classes are

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.