2015-11-07 29 views
0

我想根據事件的時間呈現幾個小圓圈,我希望它看起來像這樣,警報的時間定義在視圖加載之前定義,所以它不需要是動態的,但不知道如何去解決它,任何建議/代碼會很好,謝謝。如何在UISlider上繪製靜態圓圈?

enter image description here

回答

2

你有足夠滿足您需要的開源項目。 看看這些鏈接: http://www.brightec.co.uk/ideas/how-we-created-custom-slider-marks-ios http://www.raywenderlich.com/36288/how-to-make-a-custom-control http://www.alexanderbatalov.com/journal/2015/2/20/how-to-implement-custom-uislider-in-swift

在連接到畫圈子,你可以簡單的使用上的UIView,之後將此代碼添加到這個滑塊

func initializeCircle() { 
    self.layer.cornerRadius = self.bounds.width/2 
    self.layer.borderColor = UIColor.whiteColor().CGColor 
    self.layer.borderWidth = 2.0 
}