title: UISlider's minView goes beyond it's bounds and thumb's center
body: <p>I wanted a custom slider and the requirement was the height of minView should be 8 pt &amp; maxView should be 4 pt, it's the visible corners should be rounded.</p>
  
  <p>I gave the slider's min &amp; max image as clear image of alpha as 0.0</p>
  
  <p>For maxView, I created a UIView and gave it width equal to slider's width, and made it's corners rouneded.</p>
  
  <p>For minView, I created a UIView and it's leading is equal to leading of slider and trailing should be equal to the center of the thumb.</p>
  
  <p><a href="https://i.stack.imgur.com/j8hBe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j8hBe.png" alt="enter image description here"></a></p>
  
  <p>Here is the logic for what I did.</p>
  
  <pre><code>func changeValue() {
      let difference = slider.maximumValue - slider.minimumValue
      let thumbWidth = CGFloat(44/2)
      let scale = (slider.frame.size.width-thumbWidth)/CGFloat(difference)
      let width = scale * CGFloat(slider.value)
      minSlideWidth.constant = width
      self.view.layoutIfNeeded()
  }
  </code></pre>
  
  <p>But the minView's width doesn't increase and decrease it's width with the thumb's center. If you see the image it had already crossed the UIslider's thumb.</p>
  
  <p><a href="https://i.stack.imgur.com/B5HM3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B5HM3.png" alt="enter image description here"></a></p>