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

A text label versus number format for values displayed above min/max value #114

Closed
MarcCJohnson opened this issue Jun 21, 2021 · 5 comments

Comments

@MarcCJohnson
Copy link

It would be nice to be able to display a text label over the min/max value based upon that value.

example one: if min range value is < 10 but > 5 "a small value" but > 10 "a bigger value"

example two: # of seconds to display the time above the slider's min/max value

So generally a text label that uses the numeric value to calculate something a bit more complex than numeric format.

@MarcCJohnson
Copy link
Author

Created a pull request with this in it yesterday for your evaluation.

@MarcCJohnson
Copy link
Author

Checking back on this... been using it in my project. Please let me know if you have any questions/concerns.

@TomThorpe
Copy link
Owner

Hi Marc,

Sorry for the long delay on this. If I'm honest I don't really maintain this project anymore, although I do still appreciate peoples input and help!

For your suggestion (and the PR you raised), would it not be possible to use the existing numberFormatterOverride property instead? The intention of this from the readme is:

numberFormatterOverride

Each handle in the slider has a label above it showing the current selected value. By default, this is displayed as a decimal format.

You can override this default here by supplying your own NSNumberFormatter. For example, you could supply an NSNumberFormatter that has a currency style, or a prefix or suffix.

So by subclassing NSNumberFormatter and having it do whatever you want, you could then format the min and max labels however you want?

Thanks for your input,
Tom

@MarcCJohnson
Copy link
Author

My use case was/is to replace the labels with time format which could have included text like dd/mmm-Yy or really any date format, so more than overriding a number format. I did implement a solution and created a pull request that implements an optional method on the ttrangesliderdelegate with a working example. I see there's option to request a review of it that I thought I'd used but maybe not. I am new to using GitHub even though I've been around it forever.

@TomThorpe
Copy link
Owner

Hey Marc,

No problem at all, I do see the pull request there, however, I think you can already perform this functionality using the numberFormatterOverride property that already exists.

I really appreciate your input though nonetheless, especially as you're new to using Github. You did all the right things :-) It's just that I think this feature is already possible.

Thanks again though :-)

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