You can use the addTarget: action: forControlEvents method.
UISegmentControl *mySegmentedControl = [UISegmentControl ...]; [mySegmentedControl addTarget:self action:@selector(segmentValueChanged:) forControlEvents:UIControlEventValueChanged];
source share