Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get value from segmented control to know which one was picked [closed]

I want to be able to use a segmented control, but I don't know how to get the value for which one was picked. I want to know so I can use a boolean value to determine between the two that were picked

like image 558
user3000847 Avatar asked Dec 26 '13 06:12

user3000847


1 Answers

Add method for segment using

[YourSegment addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];

- (IBAction)segmentAction:(UISegmentedControl *)sender
{    
    NSString * theTitle = [sender titleForSegmentAtIndex:sender.selectedSegmentIndex]
}
like image 98
Pradhyuman sinh Avatar answered Nov 15 '22 18:11

Pradhyuman sinh