UIProgressView
UIProgressView *progress; //进度
progress = [[UIProgressViewalloc]initWithFrame:CGRectMake(20,350,200,20)];
//进度条颜色
progress.trackTintColor = [UIColorredColor];
//进度条已经进行的进度的颜色
progress.progressTintColor = [UIColorblueColor];
//进度条的进度 添加计时器 0.1秒 更新进度 也可以设置其他 0 ~ 1之间
progress.progress =player.currentTime/player.duration;
[self.viewaddSubview:progress];
@property(nonatomic)UIProgressViewStyle progressViewStyle;
@property(nonatomic)float progress; // 0.0 .. 1.0, default is 0.0. 进度条 进度
@property(nonatomic,strong,nullable)UIColor* progressTintColor 已经走过的颜色
@property(nonatomic,strong,nullable)UIColor* trackTintColor 还没走的颜色
@property(nonatomic,strong,nullable)UIImage* progressImage
@property(nonatomic,strong,nullable)UIImage* trackImage
- (void)setProgress:(float)progress animated:(BOOL)animatedNS_AVAILABLE_IOS(5_0);
@property(nonatomic,strong,nullable)NSProgress *observedProgressNS_AVAILABLE_IOS(9_0);更新进度
UISlider 滑动器
slider = [[UISlideralloc]initWithFrame:CGRectMake(20,370,200,20)];
slider.maximumValue =10;//最大
slider.minimumValue =0;//最小
slider.value =5; //
//可以在 下面的方法里面修改 slider.value 当前滑动器的位置
[slideraddTarget:selfaction:@selector(sliderMethod)forControlEvents:UIControlEventValueChanged];
[self.viewaddSubview:slider];
@property(nonatomic)float value; // default 0.0. this value will be pinned to min/max 当前的值
@property(nonatomic)float minimumValue; // default 0.0. the current value may change if outside new min value 最小值
@property(nonatomic)float maximumValue; // default 1.0. the current value may change if outside new max value 最大值
@property(nullable,nonatomic,strong)UIImage *minimumValueImage; // default is nil. image that appears to left of control (e.g. speaker off)
@property(nullable,nonatomic,strong)UIImage *maximumValueImage; // default is nil. image that appears to right of control (e.g. speaker max)
@property(nonatomic,getter=isContinuous)BOOL continuous; // if set, value change events are generated any time the value changes due to dragging. default = YES
@property(nullable,nonatomic,strong)UIColor *minimumTrackTintColor NS_AVAILABLE_IOS(5_0)UI_APPEARANCE_SELECTOR;
@property(nullable,nonatomic,strong)UIColor *maximumTrackTintColor NS_AVAILABLE_IOS(5_0)UI_APPEARANCE_SELECTOR;
@property(nullable,nonatomic,strong)UIColor *thumbTintColor NS_AVAILABLE_IOS(5_0)UI_APPEARANCE_SELECTOR;
- (void)setThumbImage:(nullableUIImage *)image forState:(UIControlState)state;
- (void)setMinimumTrackImage:(nullableUIImage *)image forState:(UIControlState)state;
- (void)setMaximumTrackImage:(nullableUIImage *)image forState:(UIControlState)state;
- (nullableUIImage *)thumbImageForState:(UIControlState)state;
- (nullableUIImage *)minimumTrackImageForState:(UIControlState)state;
- (nullableUIImage *)maximumTrackImageForState:(UIControlState)state;
@property(nullable,nonatomic,readonly)UIImage *currentThumbImage;
@property(nullable,nonatomic,readonly)UIImage *currentMinimumTrackImage;
@property(nullable,nonatomic,readonly)UIImage *currentMaximumTrackImage;
- (CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
- (CGRect)maximumValueImageRectForBounds:(CGRect)bounds;
- (CGRect)trackRectForBounds:(CGRect)bounds;
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value;
UISwitch 滑动开关
switchView = [[UISwitchalloc]initWithFrame:CGRectMake(100,300, 60,40)];
[switchViewaddTarget:selfaction:@selector(switchViewMethod:)forControlEvents:UIControlEventValueChanged];
switchView.on =YES; //开关状态
switchView.onTintColor = [UIColorgreenColor]; //开启的颜色
switchView.tintColor = [UIColorredColor];//关闭的颜色
switchView.thumbTintColor = [UIColorblackColor]; //滑动轮 的颜色
[self.viewaddSubview:switchView];
-(void)switchViewMethod:(UISwitch *)sender
{
if (sender.on) {
NSLog(@"开");
}else{
NSLog(@"关");
}
}
@property(nullable,nonatomic, strong)UIColor *onTintColor
@property(null_resettable,nonatomic, strong)UIColor *tintColor
@property(nullable,nonatomic, strong)UIColor *thumbTintColor
@property(nullable,nonatomic, strong)UIImage *onImage
@property(nullable,nonatomic, strong)UIImage *offImage
@property(nonatomic,getter=isOn)BOOL on;
- (instancetype)initWithFrame:(CGRect)frame
- (void)setOn:(BOOL)on animated:(BOOL)animated;// does not send action