How to store UISegmentedControle state in NSUserdefaults
- by Chrizzz
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