素材巴巴 > 程序开发 >

UI_UISlider

程序开发 2023-09-10 16:16:46
- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.self.view.backgroundColor = [UIColor whiteColor];1.创建UISlider.UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(100, 300, 200, 100)];slider.layer.borderWidth = 1;slider.layer.cornerRadius = 10;slider.backgroundColor = [UIColor greenColor];[self.view addSubview:slider];[slider release];2.添加一个出发事件.[slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];3.最大值和最小值.slider.minimumValue = 0.5;slider.maximumValue = 10;
 }4.实现事件.
 - (void)sliderAction:(UISlider *)slider {self.imageView.animationDuration = slider.value;5.给对应的图片视图添加动画[self.imageView startAnimating];
 }

这里写图片描述


标签:

素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。