To determine which segment of a UISegmentControl has been selected, you need to test its selectedSegmentIndex property
For it your segmented control will starts from 0 for the first value
// Condition for state of selection
if (segmentSwitch.selectedSegmentIndex == 0 )
{
// If it is Selected then it Will show Yes
segmentLabel.text = @"You've selected YES";
} else {
//If it is not selected then it will show NO
segmentLabel.text = @"You've selected NO";
}
Get Answers For Free
Most questions answered within 1 hours.