Autolayout issues?
sabiland opened this issue · comments
sabiland commented
On iPad after rotations this happens (look at the image).
Is there an option to force re-layout ColorSlider?
I tried layoutIfNeeded, etc. But no success Preview UIView is not correctly repositioned upon device rotations.
The easiest way to reproduce it is like this:
- Make ColorSlider Autolayouted (so the width is different for specific device orientation)
- Rotate device (iPhone or iPad)
- Preview UIView is not correctly repositioned
sabiland commented
I have temporarily fixe this with adding this function to ColorSlider and calling it after device rotate.
public func forceRepositionPreviewView()
{
let sliderProgress = gradientView.calculateSliderProgress(for: internalColor)
centerPreview(at: CGPoint(x: sliderProgress * bounds.width, y: sliderProgress * bounds.height))
}