Pierre
Pierre

Reputation: 160

segmented control give a number value

I have a segmented control and when the user selects the first segment I want it to pass the number 0, second segment 1, and third segment 2. So that I later can do like this:

NSString *submitFormJS = [NSString   
stringWithFormat:@"document.getElementById('usertype').value='**%@**';", **segment**];

where the segment is equal to the number: 0, 1 or 2.

Upvotes: 0

Views: 329

Answers (1)

Cyrille
Cyrille

Reputation: 25144

UISegmentedControl has a property named selectedSegmentIndex that you might find useful for this.

Upvotes: 1

Related Questions