How to store UISegmentedControle state in NSUserdefaults
Posted
by Chrizzz
on Stack Overflow
See other posts from Stack Overflow
or by Chrizzz
Published on 2010-04-12T21:17:57Z
Indexed on
2010/04/12
21:23 UTC
Read the original article
Hit count: 337
The problem is when de selectedSegmentIndex is unselected: "UISegmentedControlNoSegment" alias "-1".
The other states (0, 1, 2 , etc.), I can store as Integers and retrieve with
carTypeSegmentedControl.selectedSegmentIndex = [defaults integerForKey:@"typeOfCar"];
But -1 is no NSInteger.
I also tried to remove the Integer out of the NSUserdefaults but a request would return an "0", which is not acceptable.
So, is there another easy way?
tnx for reading
© Stack Overflow or respective owner