swift中UIProgressView的使用

2021-07-23 16:21:00 字數 1338 閱讀 6135

預設高度是2.0。自定義高度無效,可通過transform屬性設定高度

[html]view plain

copy

// 例項化(預設高度是2.0。自定義高度無效,可通過transform屬性設定高度)  

let progressview

= uiprogressview

(frame: cgrectmake(10.0, 10.0, (cgrectgetwidth(self.view.bounds) - 10.0 * 2), 10.0))  

self.view.addsubview(progressview)  

progressview.backgroundcolor

= uicolor

.greencolor()  

// 樣式  

progressview.progressviewstyle

= uiprogressviewstyle

.bar  

// 初始化進度(預設是0.0,且值範圍為0.0~1.0)  

progressview.setprogress(0.3, animated: true)  

// 進度條顏色  

progressview.progresstintcolor

= uicolor

.redcolor()  

progressview.tracktintcolor

= uicolor

.browncolor()  

progressview.tintcolor

= uicolor

.greencolor()  

// 更改進度條高度  

progressview.transform

= cgaffinetransformmakescale

(1.0, 3.0);  

[html]view plain

copy

// 預設高度2.0  

swift中UIProgressView的使用

預設高度是 2.0。自定義高度無效,可通過 transform 屬性設定高度 例項化 預設高度是2.0。自定義高度無效,可通過transform屬性設定高度 let progressview uiprogressview frame cgrectmake 10.0,10.0,cgrectgetwid...

swift中collectionView的簡單用法

之前寫過oc中collectionview的用法,現在再看看swift中collectionview的用法,有興趣的朋友,可以兩者前後比較下區別,swift現在沒有穩定下來,語法更新的比較快,但是它核心的一些東西,已經定型了。這些還是靠讀者們自己去挖掘吧。這裡簽署資料來源和 此時不需要引入layou...

swift中UIActionSheet的使用

方法1 方法2 例項化時新增 物件,同時注意新增協議 let alertsheet uiactionsheet title alerttitle,delegate self,cancelbuttontitle alertok,destructivebuttontitle alertcancel,ot...