A lightweight and interactable progress components of iOS
Find Demo/DDScrollProgressView.xcodeproj
- Add
pod 'DDScrollProgressView'
to your Podfile. - Run
pod install
orpod update
. - Import correspond header file
- Download all the files in the
DDScrollProgressView
directory. - Add the source files to you Xocde project
- Import correspond header file
DDScrollProgressView * ddView = [DDScrollProgressView DDScrollProgressView:CGRectMake(x, y, width, width)];
ddView.willChangeBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//rotating progress callback
};
ddView.didEndChangedBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//end rotated progress callback
}
DDScrollProgressView * ddView = [DDScrollProgressView DDScrollProgressView:CGRectMake(x, y, width, width)];
ddView.backgroundColor = UIColor.clearColor;
CGFloat gap = 25.0f;
ExtraIndicateView * extraView = [ExtraIndicateView extraIndicateViewWithDataSource:[ddView getSectionRadians] frame:CGRectMake(x - gap, y - gap, width + gap *2, width + gap *2)];
ddView.willChangeBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//rotating progress callback
//Coloring ExtraIndicateView number
[extraView setSelectedIndicate: ceil(round(progressView.curScale / (float)[progressView getNumberOfSegmentsInSection]))];
//[extraView setSelectedIndicate: ceil(round(progressView.curScale / 5.0))];
};
ddView.didEndChangedBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//end rotated progress callback
}
- Summary look below, detail find to
Demo/DDScrollProgressView.xcodeproj
//set currently scale then refresh
-(void)setCurScale:(NSInteger)curScale;
//set currently radian then refresh
-(void)setCurRadian:(CGFloat)curRadian;
//set the radian of blank area
-(void)setBlankAreaWithIgnoreRadian:(CGFloat)radian;
//The total number of segment bar and section,maybe discharge some segment when cannot divisible
-(void)setTotalsSegmentCounts:(NSInteger)counts andSections:(NSInteger)sections;
// getter radians of sections
-(NSArray *)getSectionRadians;
This library requires iOS 8.0+
and Xcode 8.0+
.
MIT license. See LICENSE file for details.
这是一个轻量级,可交互,可定制的类仪表盘进度组件
下载demo,并运行 Demo/DDScrollProgressView.xcodeproj
- 在 Podfile 中添加
pod 'DDScrollProgressView'
。 - 执行
pod install
或pod update
。 - 导入相应头文件。
- 下载
DDScrollProgressView
文件夹内的所有内容。 - 将
DDScrollProgressView
内的源文件添加(拖放)到你的工程。
DDScrollProgressView * ddView = [DDScrollProgressView DDScrollProgressView:CGRectMake(x, y, width, width)];
ddView.willChangeBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//旋转时回调
};
ddView.didEndChangedBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//旋转结束时回调
}
- 外层带有数字显示,并且数字状态同步变化
DDScrollProgressView * ddView = [DDScrollProgressView DDScrollProgressView:CGRectMake(x, y, width, width)];
ddView.backgroundColor = UIColor.clearColor;
CGFloat gap = 25.0f;
ExtraIndicateView * extraView = [ExtraIndicateView extraIndicateViewWithDataSource:[ddView getSectionRadians] frame:CGRectMake(x - gap, y - gap, width + gap *2, width + gap *2)];
ddView.willChangeBlock = ^(DDScrollProgressView * _Nonnull progressView) {
////旋转时回调
//ExtraIndicateView,数字颜色同步变化
[extraView setSelectedIndicate:progressView.curScale];
//[extraView setSelectedIndicate: ceil(round(progressView.curScale / 5.0))];
};
ddView.didEndChangedBlock = ^(DDScrollProgressView * _Nonnull progressView) {
//旋转结束时回调
}
- 简要如下所示, 详细请查看
Demo/DDScrollProgressView.xcodeproj
更多等你来战
//设置当前的进度,并且刷新
-(void)setCurScale:(NSInteger)curScale;
//设置当前的弧度,并且刷新
-(void)setCurRadian:(CGFloat)curRadian;
//设置空白区域所占的弧度,并且刷新
-(void)setBlankAreaWithIgnoreRadian:(CGFloat)radian;
//分割线总数,分多少个组。注意:会进行“取模,去掉余数”操作
-(void)setTotalsSegmentCounts:(NSInteger)counts andSections:(NSInteger)sections;
// 得到所有组对应的弧度
-(NSArray *)getSectionRadians;
该项目最低支持 iOS 8.0
和 Xcode 8.0
。
使用 MIT 许可证,详情见 LICENSE 文件。