swift爬行篇 滑塊,進度條,步進,

2021-07-04 15:55:35 字數 1888 閱讀 3130

滑塊

1. 建立

let sli: uislider = uislider(frame: cgrectmake(10.0, 270, 300, 5)) as uislider

sli.minimumvalue = 10

sli.maximumvalue = 300

sli.continuous = false

continous屬性為true:滑塊在滑動過程中響應事件,為false時則只在滑動後響應事件

2.設定各區域的

//滑塊左邊和右邊的檢視

sli.setminimumtrackimage(uiimage(named: "green.png"), forstate: uicontrolstate.normal)

sli.setminimumtrackimage(uiimage(named: "green.png"), forstate: uicontrolstate.normal)

//滑塊的檢視

"green.png"), forstate: uicontrolstate.normal)

//滑塊最大值和最小值處的

= uiimage(named: "green.png")

= uiimage(named: "green.png")

3.響應事件和tag

sli.addtarget(self, action: "progress", forcontrolevents: uicontrolevents.valuechanged)

sli.tag = 2

4. 獲取滑塊的值

let prog:uislider = self.view.viewwithtag(2) as! uislider

let a = prog.value

進度條

1建立

let progress: uiprogressview = uiprogressview(frame: cgrectmake(10, 300, 300, 3))

progress.progress = 0.0

progress.tag = 1

2.設定

let a = 50

aaa.setprogress(a/100, animated: false)

步進控制項

1.建立

let steppro: uistepper = uistepper(frame: cgrectmake(10, 310, 300, 5))

steppro.minimumvalue = 0

steppro.maximumvalue = 100

steppro.value = 0

steppro.stepvalue = 2.0

2.響應事件

steppro.addtarget(self, action: "stepeven:", forcontrolevents: uicontrolevents.touchdown)

steppro.continuous = true

steppro.tag = 255

continuous屬性uislider類似

3.獲取步進的值

let setp: uistepper = self.view.viewwithtag(255) as! uistepper

let a = setp.value

nslog("\(a)")

flutter 雙滑塊的進度條

最近專案需要進行 區間選擇,網上找到乙個flutter帶雙滑塊的進度條外掛程式很好用,推薦給大家 syncfusion flutter sliders 18.4.48 beta這個外掛程式是國外一家知名外掛程式公司提供的,功能強大,他們還有其他外掛程式,比如圖表,日曆,等等,具體可在上搜尋syncf...

用WPF實現帶滑塊的進度條

背景 哎,用wpf的人還是太少,在網上也看到很多關於wpf未來如何發展的討論,眾說紛紜。總之,wpf的定義就是windows presentationfoundation,它是微軟推出的專門針對表示層,也就是ui的乙個東東。而且,伴隨wpf而生的xaml語言,也將因為windows 8的大力推廣而擁...

ios 滑塊進度條百分比 顯示進度

該方法監聽slider的值的改變 ibaction progresschanged uislider sender else 該方法繪製要顯示百分比的圈圈 uiimage progressimage nsstring progress context nil size uigraphicsbegin...