WWProgressMaskView

main

The progress ring function of the custom background image uses the principle of picture shielding to make the color of the progress ring more diverse...
William-Weng/WWProgressMaskView

WWProgressMaskView

Swift-5.6 iOS-14.0 TAG Swift Package Manager-SUCCESS LICENSE

  • The progress ring function of the custom background image uses the principle of picture shielding to make the color of the progress ring more diverse...
  • 自訂背景圖的進度環功能,利用圖片遮罩的原理,讓進度環的色彩更多樣化…

dependencies: [
    .package(url: "https://github.com/William-Weng/WWProgressMaskView.git", .upToNextMajor(from: "1.0.0"))
]

Function - 可用函式

函式 功能
setting(originalAngle:lineWidth:clockwise:lineCap:lineGap:innerImage:outerImage:) 設定一些初始值 => 會重畫
progressCircle(from:to:) 畫進度條 (以角度為準)
progressCircle(progressUnit:) 畫進度條

Example

import UIKit
import WWPrint
import WWProgressMaskView

final class ViewController: UIViewController {

    @IBOutlet weak var firstMaskView: WWProgressMaskView!
    @IBOutlet weak var secondMaskView: WWProgressMaskView!
    @IBOutlet weak var firstLabel: UILabel!
    @IBOutlet weak var secondLabel: UILabel!
    
    private var firstPercent = 0        // 百分比的值 (1 / 100)
    private var secondBasisPoint = 0    // 萬分比的值 (1 / 10000)
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "WWProgressMaskView"
        secondMaskView.setting(originalAngle: 90, lineWidth: 30, clockwise: true, lineCap: .round, lineGap: 10, innerImage: nil, outerImage: nil)
    }
    
    @IBAction func firstTestAction(_ sender: UIBarButtonItem) {
        firstLabel.text = "\(firstPercent) %"
        firstMaskView.progressCircle(progressUnit: .percent(firstPercent))
        firstPercent += 10
    }
    
    @IBAction func secondTestAction(_ sender: UIBarButtonItem) {
        secondLabel.text = "\(CGFloat(secondBasisPoint) / 100.0) %"
        secondMaskView.progressCircle(progressUnit: .basisPoint(secondBasisPoint))
        secondBasisPoint += 1250
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Dec 06 2024 14:39:26 GMT-1000 (Hawaii-Aleutian Standard Time)