title: Custom UISlider: avoid updating when dragging outside
body: <p>I'm quite new to iPhone development and I'm building my first app :) 
  In one of my view controllers I built a customSlider that should behave as the native "slide to unlock" slider. </p>
  
  <p>My doubt right now is how to implement the "drag outside" behaviour. As said, I would like to have it exactly as the native slider, that means that when the finger is dragging the slider if it moves out the slider, the slider should be going to zero.</p>
  
  <p>My doubt is not on the animation part (I'm already using animation block successfully), but on control events part. Which control event should I use?</p>
  
  <p>I'm using:</p>
  
  <pre><code>[customSlider addTarget:self action:@selector(sliderMoved:) forControlEvents:UIControlEventValueChanged];
  </code></pre>
  
  <p>to handle the sliding part (finger sliding the cursor), and</p>
  
  <pre><code>[customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>to handle the release part, but the problem is that if I release the finger outside, the sliderAction function it's not called.</p>
  
  <p>EDIT:
  I've tried to implement the solution @Bruno Domingues gave me, but I'm realizing that the issue is that by default UISlider keep getting updated even if the finger is dragged outside of it (try to open for example the Brightness section in System Preferences and you'll see that the slider will keep on updating even if you drag outside of it). So my question could be redefined: How to avoid this default behaviour and have the slider updating only when the finger is moving on it?</p>