amratab / FlexibleSteppedProgressBar

Flexible Stepped Progress Bar for IOS
Other
575 stars 113 forks source link

Not able to get progress bar where selected steps has white color text and remaining step has gray color text #36

Open dhaval-dobariya opened 4 years ago

dhaval-dobariya commented 4 years ago

I want stepper like this one Screenshot 2020-03-18 at 9 17 12 AM

And I have written below code:

func setupProgressBarWithDifferentDimensions() {
        progressBarWithDifferentDimensions = FlexibleSteppedProgressBar()
        progressBarWithDifferentDimensions.translatesAutoresizingMaskIntoConstraints = false
        self.view.addSubview(progressBarWithDifferentDimensions)

        // iOS9+ auto layout code
        let horizontalConstraint = progressBarWithDifferentDimensions.centerXAnchor.constraint(equalTo: self.view.centerXAnchor)
        let verticalConstraint = progressBarWithDifferentDimensions.topAnchor.constraint(
            equalTo: view.topAnchor,
            constant: 450
        )
        let widthConstraint = progressBarWithDifferentDimensions.widthAnchor.constraint(equalToConstant: 320)
        let heightConstraint = progressBarWithDifferentDimensions.heightAnchor.constraint(equalToConstant: 25)
        NSLayoutConstraint.activate([horizontalConstraint, verticalConstraint, widthConstraint, heightConstraint])

        progressBarWithDifferentDimensions.numberOfPoints = 5
        progressBarWithDifferentDimensions.lineHeight = 5
        progressBarWithDifferentDimensions.progressLineHeight = 6
        progressBarWithDifferentDimensions.radius = 16
        progressBarWithDifferentDimensions.progressRadius = 16
        progressBarWithDifferentDimensions.delegate = self
        progressBarWithDifferentDimensions.selectedBackgoundColor = progressColor
        progressBarWithDifferentDimensions.backgroundShapeColor = UIColor.lightGray
//        progressBarWithDifferentDimensions.centerLayerDarkBackgroundTextColor = UIColor.green
//        progressBarWithDifferentDimensions.centerLayerTextFont = UIFont.systemFont(ofSize: 17)
        progressBarWithDifferentDimensions.selectedOuterCircleLineWidth = 0.0

        progressBarWithDifferentDimensions.completedTillIndex = 2
        progressBarWithDifferentDimensions.currentIndex = 2

        progressBarWithDifferentDimensions.stepTextColor = UIColor.yellow
        progressBarWithDifferentDimensions.currentSelectedTextColor = UIColor.white
        progressBarWithDifferentDimensions.centerLayerTextColor = UIColor.gray
    }