Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any Other way to set Min & Max Values #36

Open
nitinumaretiya123 opened this issue Jul 4, 2019 · 1 comment
Open

Any Other way to set Min & Max Values #36

nitinumaretiya123 opened this issue Jul 4, 2019 · 1 comment

Comments

@nitinumaretiya123
Copy link

I can't figure out
sliderAge.attributedTextForFraction = { fraction in let formatter = NumberFormatter() formatter.minimum = 18 formatter.maximumIntegerDigits = 3 formatter.maximumFractionDigits = 0 let string = formatter.string(from: (fraction * 80) as NSNumber) ?? "" print("string\(string) , friction\(fraction) , \((fraction * 500))") return NSAttributedString(string: string, attributes: [.font: CalmUtility().setFont(type: .Bold, size: 12), .foregroundColor: UIColor.black]) }
can you please let me know how to set fraction to 18-80 for age range

@blackcolt
Copy link

You need to do it in the formatter

let string = formatter.string(from: MIN + (fraction * (MAX - MIN)) as NSNumber) ?? ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants