環形進度條的實現

2021-07-26 23:43:38 字數 1843 閱讀 8187

//新增**

在所需要展示進度條的類裡引入類

#import 

"dacircularprogressview.h"

#import

"dalabeledcircularprogressview.h"

方法的呼叫與實現

//.h

// labeled progress views

@property (strong, nonatomic) dalabeledcircularprogressview *labeledprogressview;

@property (strong, nonatomic) uistepper *stepper;

@property (strong, nonatomic) nstimer *timer;

//.m

@synthesize stepper = _stepper;

@synthesize timer = _timer;

viewdidload中實現

//進度條的初始化

self

.labeledprogressview = [[dalabeledcircularprogressview alloc] initwithframe:cgrectmake(100.0f, 100.0f, 60.0f, 60.0f)];

self

.labeledprogressview

.roundedcorners = no;

[self

.view addsubview:self

.labeledprogressview];

//修改展示形式

self

.labeledprogressview

.tracktintcolor = [uicolor graycolor];

self

.labeledprogressview

.progresstintcolor = [uicolor whitecolor];

self

.labeledprogressview

.thicknessratio = 1.0f;

self

.labeledprogressview

.clockwiseprogress = no;

[self startanimation];

//自定義乙個時間控制器

- (void)startanimation

//進度label的顯示

- (void)progresschange

cgfloat number= self

.labeledprogressview

.progress*100;

self

.labeledprogressview

.progresslabel

.text = [nsstring stringwithformat:@"%.f%%", number];

}

環形進度條

在專案中做廣告頁,需要乙個5s倒計時的進度條。就用了calayer寫了乙個簡單的進度條。直接上 import inte ce circularprogressview uiview void start void stop import circularprogressview.h import i...

環形進度條

先上效果圖 不多。直接貼 html 0 css body box rotate left right center popu left before left after input radius bg radius dot radius dot before radius dot before s...

環形進度條

先上效果圖 設定進度 param progress public void setprogress int progress 得到 circularprogressbar 物件,用來設定其他的一些屬性 return public circularprogressbar getcircularprog...