ColorSlider icon indicating copy to clipboard operation
ColorSlider copied to clipboard

Autolayout issues?

Open sabiland opened this issue 7 years ago • 1 comments

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:

  1. Make ColorSlider Autolayouted (so the width is different for specific device orientation)
  2. Rotate device (iPhone or iPad)
  3. Preview UIView is not correctly repositioned

sabiland avatar Jun 27 '18 06:06 sabiland

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))
    }

sabiland avatar Oct 07 '18 08:10 sabiland