SwiftRangeSlider
SwiftRangeSlider copied to clipboard
Constrains not updating on other screen resolutions than default
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()
}
}
Hmm.. I'll take a look and do some debugging. Will get back to you ASAP :)
Hi @BrianCorbin , I am facing the same issue, not sure if you have found the solution for this?
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.
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()
}