UIStepper
初始化设置位置
UIStepper *stepper =[ [UIStepper alloc]initWithFream:CGRectMake(x,y,w,h)];
添加事件
[stepper addTarget:self action:@selector(function:)
forControlEvents:UIControlEventValueChanged];
-(void)function
{
NSLog(@"%d",stepper.value);
}
设置方法只有在值改变结束时才触发
stepper.continuous = YES;(值变动的话,就会调用方法)
设置值按下去是否连续改变
steep.autorepeat = NO;(为NO是按住不ss放时候值只会增加一次)
设置最大最小值
stepper.minimumValue = 1;
stepper.maximumValue = 10;
设置时候循环
stepper.wraps = YES;
设置步长
stepper.stepValue = 2;
设置颜色
stepper.tintColor = [UIColor greenColor];
添加到当前视图上
[self.view addSubview:steep];