一。分段控件(UISegmentedControl)
UISegmentedControl *segment = [[UISegmentedControl alloc ] initWithItems : @ [ @"1",@"2",@"3"] ]; //@[ ] 表示快速创建数组
(1)给segmentedControl绑定方法
[segment addTarget:self action:@selector(segmentedAction:) forControlEvents:UIControlEventValueChanged];
(2)改变segment的颜色。。。
[segment setTintColor:[UIColor purpleColor]]; //填充色
[segment setBackgroundColor:[UIColor yellowColor]];
(3)设置背景图片
[segment setBackgroundImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
二。滑动条控件(UISlider)
UISlider *slider = [[UISlider alloc]initWithFrame:CGRectMake(20, 60, 280, 50)];
[slider addTarget:self action:@selector(sliderAction:) forControlEvents:(UIControlEventValueChanged)];
(1)设置selder最大值,最小值
[slider setMaximumValue:100];
[slider setMinimumValue:10];
(2)控件前后图片
slider setMaximumValueImage:(UIImage *)
三,UIStepper
UIStepper *stepper = [[UIStepper alloc]initWithFrame:CGRectMake(20, 110, 30, 30)];
[stepper addTarget:self action:@selector(stepperAction:) forControlEvents:(UIControlEventValueChanged)];
四。UISwitch
UISwitch *switch1 = [[UISwitch alloc] initWithFrame:CGRectMake(150, 110, 30, 30)];
[switch1 addTarget:self action:@selector(switchAction:) forControlEvents:(UIControlEventValueChanged)];
五。UIImageView
利用UIImageView播放gif动图
(1)将图片数组给imageView 等待播放
imageView.animationImages = imageArr;
( 2 ) 播放速度(播放一遍需要的秒数)
imageView.animationDuration = 2
(3)播放次数
imageView。animationRepeatCount = 0 ; //默认为0 0和 -1 代表次数无限
(4)播放
[imageView startAnimating];