本文主要是介绍UI_UIStepper,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.self.view.backgroundColor = [UIColor whiteColor];1.创建UIStepper
UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(100, 100, 0, 0)];stepper.backgroundColor = [UIColor greenColor];[self.view addSubview:stepper];[stepper release];[stepper addTarget:self action:@selector(stepperAction:) forControlEvents:UIControlEventValueChanged];2.设置最大值,最小值.stepper.minimumValue = 1;stepper.maximumValue = 100;3.设置变化频率.stepper.stepValue = 2;
}4.设置控制方法.
- (void)stepperAction:(UIStepper *)stepper {5.使player的音量与stepper的值相等.self.player.volume = stepper.value;
}
这篇关于UI_UIStepper的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!