RangeSeekSlider icon indicating copy to clipboard operation
RangeSeekSlider copied to clipboard

Change label position

Open pt9dat opened this issue 4 years ago • 4 comments

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

pt9dat avatar Apr 24 '20 03:04 pt9dat

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.

Franknxtn avatar Apr 28 '20 10:04 Franknxtn

+1

SteveChina avatar May 02 '20 03:05 SteveChina

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

AngCosmin avatar May 21 '20 13:05 AngCosmin

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)

jigneshradadiya avatar Jul 25 '20 13:07 jigneshradadiya