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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:01:52+00:00 2026-06-16T01:01:52+00:00

I have a table with four rows, each having a title and switch as

  • 0

I have a table with four rows, each having a title and switch as an accessory. I would like for the plist Boolean value to be updated when the corresponding switch is tapped.

Plist:

<array>
    <dict>
        <key>Bools</key>
        <array>
            <false/>
            <false/>
            <false/>
            <false/>
        </array>
        <key>Strings</key>
        <array>
            <string>String0</string>
            <string>String1</string>
            <string>String2</string>
            <string>String3</string>
        </array>
    </dict>
</array>

Here are the data source methods:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; {
return [allergens count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; {
return [[[allergens objectAtIndex: section] objectForKey: @"Strings"] count];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; {
return @"Header";
}

Here is my switch, with selector: switchToggled

UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
cell.accessoryView = switchView;
[switchView addTarget:self action:@selector(switchToggled:) forControlEvents: UIControlEventTouchUpInside];

Below is the IBAction method. I can successfully get the switch tapped to appear in the log, so I know everything works. I am just not sure how to get the correct Boolean value to be updated.

- (IBAction)switchToggled:(id)sender {
NSLog(@"switch tapped");
}

Any help is appreciated! Thanks.

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

    I was so new to programming when I posted this I was not aware that I could not programmatically edit a plist in the main bundle at runtime. I now understand that to achieve the effect I want I should save the starting plist to the app documents directory and work from that. I used this article to help format the process of saving and loading data to and from the documents directory.

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

Sidebar

Related Questions

I have a table with one column and four rows. Each tr has a
In my app I have a scroll view and four table views. Each time
I used JPA and mysql. Each table have entity class.I have four tables. Table1
i have four tables like below in sql server 2008 : TABLE 1 ->
In my table accounts I have four columns like user, pass, column1, column2 I
I have a temp table in which have one column with four rows. Table
I have table with rows of strings. I'd like to search for those strings
I am wanting to have a view table that aggregates rows from four tables.
I have a table of rows holding four different fields of numbers: people, debris,
In my index.php I have TABLE with four rows. One of them contains INPUT

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.