alskipp / ASValueTrackingSlider

A UISlider subclass that displays the slider value in a popup view
MIT License
1.84k stars 235 forks source link

Improved control of popupview dimensions #28

Closed koenvanderdrift closed 9 years ago

koenvanderdrift commented 9 years ago

First of all, thank you very much for sharing this class! I've been looking for something like this for a while, but all solutions I came across were pretty outdated.

Anyway, I'm using a pretty small font (size 12) for the text in the popUpView, and the relative size IMO of the popUpView is too big for that. I was able to tweak it by decreasing the values of ARROW_LENGTH and MIN_POPUPVIEW_HEIGHT, and it looks much better proportionally. Is this maybe something that could be built in the class, eg by making those constants a property, or size them based on the font size?

alskipp commented 9 years ago

Hi @koenvanderdrift, Thanks for your interest in the project and your suggestions. There is another branch which may address the issue you have: https://github.com/alskipp/ASValueTrackingSlider/tree/popup_refactor

It includes a few small API changes and also improves the animation code. The popUpView also adapts better to smaller font sizes. One thing that does need improving is the way it handles single digit numbers (the popUpView currently looks too small with single digit numbers).

Let me know if this branch works for you. The plan is to eventually merge it into the master branch.

All the best, Al

koenvanderdrift commented 9 years ago

Hi @alskipp,

Thanks for pointing me that branch. Indeed the ratio of the font size and the popUpView size is much better. But as you say, it doesn't look good with single digit numbers. I'm glad to do any testing if needed.

Cheers,

alskipp commented 9 years ago

Thanks to a contribution by @vince4, this issue should be solved. It is now possible to set the following property CGFloat popUpViewWidthPaddingFactor.

For example: a value of 2.0 would make the popUpView twice as wide as the width of the text.

The changes are merged into master, but haven't been updated on CocoaPods yet.