Tag: uistepper

如何使用UIStepper

我正在尝试使用UIStepper来递增或递减整数,但“ – ”和“+”都会增加整数! 我怎样才能识别“+”和“ – ”button? 在UIStepper头文件中有两个UIButton : UIButton *_plusButton; UIButton *_minusButton; 例如 : – (IBAction)changeValue:(id)sender { UIStepper *stepper = (UIStepper *) sender; stepper.maximumValue = 10; stepper.minimumValue = 0; if (stepper) { integer++; [label setText:[NSString stringWithFormat:@"%d",integer]]; } else { integer–; [label setText:[NSString stringWithFormat:@"%d",integer]]; } }