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

Change label position #93

Open
pt9dat opened this issue Apr 24, 2020 · 4 comments
Open

Change label position #93

pt9dat opened this issue Apr 24, 2020 · 4 comments

Comments

@pt9dat
Copy link

pt9dat commented Apr 24, 2020

Issue Description

Hi, can I change the label position from bottom to top?

Environment

  • Library version: 1.8.0
  • iOS version: 13.4.1
  • Swift version: 5
@Franknxtn
Copy link

I'm also facing the same problem, all the examples have labels at top but i have at bottom and there is no way other than setting the label padding to a negative value. wish there was a more straightforward way to place label on top of slider.

@SteveChina
Copy link

+1

@AngCosmin
Copy link

I was able to do it by setting the Label padding property to a negative value. For example, I used -60

@jigneshradadiya
Copy link

I'm also facing the same problem, all the examples have labels at top but i have at bottom and there is no way other than setting the label padding to a negative value. wish there was a more straightforward way to place label on top of slider.

I got the solution for this issue. Just update below code in RangeSeekSlider.swift file

/* Old code
let newMinLabelCenter: CGPoint = CGPoint(x: leftHandle.frame.midX,
y: leftHandle.frame.maxY + (minLabelTextSize.height/2) + labelPadding)
let newMaxLabelCenter: CGPoint = CGPoint(x: rightHandle.frame.midX,
y: rightHandle.frame.maxY + (maxLabelTextSize.height/2) + labelPadding)*/
//Try this
// Updated code to set labels above the handle
let YPossitionMin=leftHandle.frame.midY - (minLabelTextSize.height + labelPadding)
let YPossitionMax=rightHandle.frame.midY - (maxLabelTextSize.height + labelPadding)
let newMinLabelCenter: CGPoint = CGPoint(x: leftHandle.frame.midX, y: YPossitionMin)
let newMaxLabelCenter: CGPoint = CGPoint(x: rightHandle.frame.midX, y:YPossitionMax)

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

5 participants