SwiftRangeSlider icon indicating copy to clipboard operation
SwiftRangeSlider copied to clipboard

Constrains not updating on other screen resolutions than default

Open kingalione opened this issue 7 years ago • 4 comments

When I run my application on a iPhone 7 Plus or iPhon 5S the range sliders are initially ether to small or to big for the width. Only after scrolling the rangesliders out of the viewport the constraints getting updated correctly.

I tried the solution with updateLayerFramesAndPositions but it didn't worked.

My rangesliders are inside a tableview and looking like this:

class RangeSliderLinearTableViewCell: UITableViewCell {

@IBOutlet weak var rangeSlider: RangeSlider!

override func awakeFromNib() {
    super.awakeFromNib()
    self.rangeSlider.updateLayerFramesAndPositions()
}

}

kingalione avatar Nov 07 '17 13:11 kingalione

Hmm.. I'll take a look and do some debugging. Will get back to you ASAP :)

briancorbin avatar Nov 14 '17 22:11 briancorbin

Hi @BrianCorbin , I am facing the same issue, not sure if you have found the solution for this?

shyeoh avatar Dec 06 '17 08:12 shyeoh

I did this and it seems to resolve it

  override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    
    rangeSlider.layoutIfNeeded()
    rangeSlider.updateLayerFramesAndPositions()
  }

My range slider is inside a Table View also.

biscottigelato avatar Dec 11 '17 01:12 biscottigelato

I found that range slider does not show properly whenever Auto Layout is used, and adding the following method to RangeSlider helps:

open override func layoutSubviews() {
    super.layoutSubviews()
    updateLayerFramesAndPositions()
}

ystsoi avatar May 09 '18 07:05 ystsoi