selectedSegmentIndex not updating UISegmentControl
Posted
by munchine
on Stack Overflow
See other posts from Stack Overflow
or by munchine
Published on 2010-04-28T04:49:33Z
Indexed on
2010/04/28
4:53 UTC
Read the original article
Hit count: 483
iphone
|uisegmentedcontrol
In my viewDidLoad, I'm retrieving user preferences and updating the settings tab. It is working for editSelection (see code) but the other
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
BOOL editSelection = [userDefaults boolForKey:@"editToggleSwitch"];
editingToggle.selectedSegmentIndex = editSelection; // this is working!
bToggle.selectedSegmentIndex = [[userDefaults objectForKey:@"bSegment"] intValue];
In the view, the editingToggle segment is displaying correctly but bToggle is always at 0? NSLog shows that the data was saved and retrieved correctly. I've even set
bToggle.selectedSegmentIndex = 1;
but it still does not reflect correctly in the view? Any ideas?
© Stack Overflow or respective owner