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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:21:25+00:00 2026-05-22T20:21:25+00:00

I am trying to receive the user selection from a segmented control and then

  • 0

I am trying to receive the user selection from a segmented control and then save it to NSUserDefaults, i.e., if the first segment is selected then it saves the int “1” to NSUserDefaults, but if the second segment is selected then it saves the int “2” to NSUserDefaults.

  • 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-22T20:21:26+00:00Added an answer on May 22, 2026 at 8:21 pm

    The easiest way is to use a binding. Bind the selected index of the control to the shared user defaults controller, and set the model key path to the preference key you want to use.

    Edit to add: I see that you didn’t specify Mac or iOS. If it’s Mac, binding is definitely the easy way, whereas binding is not available on iOS.

    The fact that segmented control values start at 0 is unimportant. You could bind selected tag rather than selected index, and then use any tag values you want.

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

Sidebar

Related Questions

I am basically trying to return from a method which reads user input from
Trying to make a make generic select control that I can dynamically add elements
I'm trying to determine how I can detect when the user changes the Windows
I am trying to send user registered message to window procedure, procedure receives a
I am trying to alter a query that will allow not only the user
I'm trying to make a UITableView that when a user selects a cell it
I have gitosis setup on my server and I'm trying to create a post-receive
I am currently trying to design a client-server application, something like this: the user
I received a MySQL data dump and am trying to insert the data into
I'm trying to get quoted parameters of a bash script to safely be received

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.