iOS——UIProgressView
2017-04-03 20:23
363 查看
一、概述
1. UIProgressView 是一个简单的进度条控件,用法较简单,属性也较少2. 从名称就可以看出,它是一个视图并且直接继承 UIView,所以它不能相应一系列的事件,只是一个单纯显示的视图
二、属性
1. UIProgressView 对象重写了自己的 initWithFrame: 方法,目的是只能改变 width、height 不能改变- (instancetype)initWithFrame:(CGRect)frame;
2. 设置 UIProgressView 对象的风格
- (instancetype)initWithProgressViewStyle:(UIProgressViewStyle)style;
typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
UIProgressViewStyleDefault, // 普通样式
UIProgressViewStyleBar // 工具栏样式
};
3. 设置 UIProgressView 对象的风格;默认为 UIProgressViewStyleDefault
@property(nonatomic)
UIProgressViewStyle progressViewStyle;
4. 设置进度条的当前值;默认为 0,并且范围在 0 ~ 1 之间
@property(nonatomic)
float progress;
5. 设置已经走过进度条的颜色
@property(nonatomic,
strong, nullable)
UIColor* progressTintColor;
6. 设置还未走过进度条的颜色
@property(nonatomic,
strong, nullable)
UIColor* trackTintColor;
7. 设置已经走过进度条的图片
@property(nonatomic,
strong, nullable)
UIImage* progressImage;
8. 设置还未走过进度条的图片
@property(nonatomic,
strong, nullable)
UIImage* trackImage;
9. 设置进度条的当前置,并设置动画效果
- (void)setProgress:(float)progress animated:(BOOL)animated;
三、其他
1. 当要设置 UISlider 和 UIProgressView 关联时,有两种情况1)UISlider 对象的 minimumValue 和 maximumValue 在 0 ~ 1 之间时(和 UIProgressView 的范围一致)
_progressView.progress = _slider.value;
2)UISlider 对象的 minimumValue 和 maximumValue 不在 0 ~ 1 之间时(和 UIProgressView 的范围不一致),此时需要将 UISlider 的值做一个百分比的转换
_progressView.progress = (_slider.value - _slider.minimumValue) / (_slider.maximumValue - _slider.minimumValue);
相关文章推荐
- IOS学习笔记20—UIActivityIndicatorView、UIProgressView
- iOS编程之UIProgressView
- IOS UIActivityIndicatorView、UIProgressView
- [IOS] iphone之UISegmentedControl
- iOS UIResponder 学习笔记
- 在ios中对定制的UIPickerView 进行数据定位
- iOS开源代码 —— 非UI
- iOS UIResponder 学习笔记
- iOS 界面设计指南(iOS UI)pdf下载
- iOS开发 UIPickerView的使用
- UIActivityIndicatorView、UIProgressView 活动与进度指示器-IOS开发
- iphone/ipad ios cocoa object-c 近期苹果UI部分小结
- iOS下UILocalNotification的使用
- ios本地通知UILocalNotification和远程通知UINotification
- [ios开发技巧之]UIPickerView的数据循环显示
- iOS开源代码 —— UI相关
- iOS中控制器的实践和学习(1)-抛出UI问题
- IOS开发UI展示之UITableView ──分页加载
- IOS后台线程更新UI的一个陷阱
- ios中UI和常用动画汇总 抖动等现成的动画