title: iOS Datepicker: How to LOCK invalid dates?
body: <p>I've been struggling with the maximum/minimum date lately, and honestly, I don't know what I'm missing here. I searched a lot and no one seems to complain about it. (I'm not talking about setting a maximum/minimum date as these can only make invalid dates appear gray)</p>
  
  <p>Here's what I've done so far:</p>
  
  <pre><code>    [myDatePicker addTarget:self action:@selector(disableDate) forControlEvents:UIControlEventValueChanged];
  </code></pre>
  
  <p>Then, on disableDate, I have something like this:</p>
  
  <pre><code>if ([myDatePicker.date compare:[NSDate date]] == NSOrderedDescending) {
          MyDatePicker.date = [NSDate date];
      }
  </code></pre>
  
  <p>(Or ascending, it depends on which dates I want to disable)</p>
  
  <p>The thing is: it works fine but only ONCE. In other words: as soon as I open the view and try to pick, for example, 2007, it scrolls back to 2013. Great. But right after that, if I try to scroll to any invalid date (including 2007), it won't scroll back anymore until I reopen my view.
  I feel like I'm missing something simple here, but I don't know what.</p>
  
  <p>Thanks a lot in advance!</p>
  
  <p>PS: Just to mention, I've put this inside disableDate</p>
  
  <pre><code>    NSLog(@"Value changed");
  </code></pre>
  
  <p>just to make sure it's calling the method everytime I scroll the datepicker, and yes, it is working;</p>
  
  <p>PS2: I've tried the same but using</p>
  
  <pre><code>- (IBAction)datePickerValueChanged:(id) sender
  </code></pre>
  
  <p>instead and it had exactly the same behaviour.</p>