UIStepper *
step = [[UIStepper alloc]initWithFrame:CGRectMake(
5,
30,
30,
30)];
step.tintColor = [UIColor redColor];
step.backgroundColor = [UIColor grayColor];
[
step addTarget:self action:@selector(stepAction:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:
step];
step.value =
50;
step.stepValue =
10;
[
step setMinimumValue:
0];
[
step setMaximumValue:
500];
NSLog(@
"%f",
step.value);
step.continuous = NO;
调用方法:
-(void)stepAction:(UIStepper*)sender
{
NSLog(@"%f",sender.value);
}