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.
- (IBAction)totalAction:(id)sender {
toggleNav = sender; // this is your segmented control
if ([toggleNav selectedSegmentIndex] == 0) {
NSlog(@"i am here");
} else if ([toggleNav selectedSegmentIndex] == 1) {
NSlog(@"i am here");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With