luispadron / UICircularProgressRing

A circular progress bar for iOS written in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Value Indicator Format Not Working

xaepstudio opened this issue · comments

commented

Version

  • Version = UICircularProgressRing 6.2.1

Details

  • Has the question been answered here before?
    • YES, BUT SUPPLIED ANSWERS DO NOT WORK.
  • Please provide as much detail as possible below

Thanks for a great component! Here is the issue:

  • I want to customize the UICircularProgressRing ValueIndicator text to display a value greater than MaxValue in certain instances.
  • I have read the full documentation and answers to questions related to formatting and customizing the ValueIndicator text here on GitHub and have learned that this is not supported.
  • There is a suggestion to turn off the ValueIndicator text and replace it with a custom label; however, I do not see any guidance in the documentation or in answers on GitHub for accomplishing this. So, I decided to try setting the ring fontColor property to clear, but this does not work.

Here is the code I am using:

let ringProgressView = UICircularProgressRing()
let ringFormatter = UICircularProgressRingFormatter(valueIndicator: "%", rightToLeft: false, showFloatingPoint: true, decimalPlaces: 2)
ringProgressView.valueFormatter = ringFormatter
ringProgressView.fontColor = UIColor.clear
ringProgressView.style = .ontop

The text continues to display in black regardless of the color that is set using the code above.

Any guidance on (a) the right way to disable the ValueIndicator text or (b) set the text fontColor to clear (to make it invisible) is appreciated.

Thank you!

i want to do the same as above! i had this before i updated the cocoapod to the latest version and now it no longer works. basically if the max value of the progress ring is 500 i need to be able to display 516/500 or any progress over or under out of. how can i accomplish this?

nvm. figured it out.

var formatter = UICircularProgressRingFormatter()
formatter.valueIndicator = "\(progress)/"
formatter.decimalPlaces = 0
formatter.rightToLeft = true
self.progressRingView.valueFormatter = formatter

@kneekey23 Do you happen to know what the issue was?

@luispadron wasn't an issue necessarily, i was just trying to get a specific format of the text and in order to get progress/maxTotal to display, i just set formatter.rightToLeft = true and then it puts whatever i set in valueIndicator to the left of maxTotal. Does that make sense?

Gotcha, just wanted to make sure it wasn't a bug. Closing this now.