多个按钮,不同操作
2017-04-28 本文已影响0人
娜娜的世界123
- (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]);
}
}