This is probably a really simple question but I can't seem to find anything in the APIs or across any search engine.
I have a Segmented control that i have set to momentary as a user will select a couple of makes of a car that they want to search for. The issue that I'm running into is that I can't seem to figure out how to recognize which segment was selected. In regular mode its a simple SelectedSegment = index but with momentary its my understanding that the selected segment is always -1 as none are ever "selected"
I have a handler for ValueChanged but I can't figure out what I'm checking for or what I should be sending to determine which segment was selected. Any help would be greatly appreciated. I'm using monotouch but Obj-C would be fine as well.
Thanks!
In your handler, you should check the selectedSegmentIndex
to determine which segment was selected:
- (void)valueChanged:(UISegmentedControl *) control {
switch([control selectedSegmentIndex]) {
case 0:
//...
break;
case 1:
//...
break;
}
}
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