- (IBAction)SelectAction:(UISegmentedControl *)sender {
SEL selectors[] = {
@selector(applyAmount),
@selector(pushVC)
};
if (sender.selectedSegmentIndex < sizeof(selectors) / sizeof(SEL)) {
void(*imp)(id, SEL) = (typeof(imp))[self methodForSelector:selectors[sender.selectedSegmentIndex]];
imp(self, selectors[sender.selectedSegmentIndex]);
}
}
网友评论