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

  • Home
  • SEARCH
  • 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 6539357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:51:00+00:00 2026-05-25T10:51:00+00:00

I have three UISegmented controls (In a utility application), each of which store their

  • 0

I have three UISegmented controls (In a utility application), each of which store their selected segments in UserDefaults when the values is changed. When the settings pane is loaded (the side with the three segmented controls), I access NSUserDefaults to highlight the current settings. For whatever reason, two of them work perfectly as desired, but one seems to randomly fluctuate when the user moves from settings pane to the mainview and back to the settings pane……

This is used to set the selected segment on flip to settings pane:

int setting2 = [defaults integerForKey:SegmentKey];
if(setting2 == 0)
{ NSLog(@"selected 0"); segmentedControlC.selectedSegmentIndex = 0; }
else
{ NSLog(@"selected 1"); segmentedControlC.selectedSegmentIndex = 1; }

This is used to assign a value to the key “SegmentKey” when the user makes a change to the selectedSegmentIndex

[defaults setInteger:segmentedControlC.selectedSegmentIndex forKey:SegmentKey];

Yet, for some reason, when I (in the simulator) press the “0” index, flip back to the main view, then return, segment one is highlighted….

  • 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-25T10:51:00+00:00Added an answer on May 25, 2026 at 10:51 am

    Make sure that you use a unique key dor each integer in NSUserDefaults. And be sure that you synchronize NSUserDefaults after you set the integer.
    Also this is faster for loading your keys:

    segmentedControlC.selectedSegmentIndex = [defaults integerForKey:key];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have three lists with the same number of elements in each other, i
i have three java based web application app1,app2 and app3 at production. All 3
I have three enums, which - in combination - should identify a unique state
I have 3 segmented controls in each cell of a tableview on an iPad.
I have three core data entities which I am importing into, they are: •
I have three TCP servers I need to connect to, each with different protocols,
I have three gyroscope values, pitch, roll and yaw. I would like to add
I have a segemented control with three choices, each choice does a different calculations.
I have an iPhone application which is, in essence, a list. There is a
Have three tables Vehicle, VehicleGroup and AssignedVehicleGroup which have the following format: Vehicle -

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.