title: iOS UIDatePicker set max date
body: <p>I got an issue in trying to limit the date. With setting the date like that <code>self.datePicker.maximumDate = [NSDate date];</code> it is only grey the date after now but enable the user to select a date after this maximum date.</p>
  
  <p>So When the picker value changed I compare the selected date if up than the current date I edit it.</p>
  
  <p>If I use both solutions I got weird behaviour, <strong>any idea ?</strong></p>
  
  <pre><code>- (IBAction)pickerValueChanged:(id)sender {
  
      dispatch_async(dispatch_get_main_queue(), ^{
          UIDatePicker *datePicker = (UIDatePicker *)sender;
  
          if ([self.datePicker.date compare:[NSDate date]] == NSOrderedDescending) {
  
              datePicker.date = [NSDate date];
          }
  
      });
  }
  </code></pre>
  
  <p>This function is triggered when the date value from the date picker did <strong>change</strong>. If I set a minimum and a maximum date I got a weird behaviour. <strong>Any idea?</strong></p>
  
  <p><strong>EDIT:</strong> </p>
  
  <ul>
  <li><a href="http://youtu.be/GX0pbyjBC-U" rel="nofollow">http://youtu.be/GX0pbyjBC-U</a> without setting <code>self.datePicker.maximumDate = [NSDate date];</code></li>
  <li><a href="http://youtu.be/U8hYVSfKRZ4" rel="nofollow">http://youtu.be/U8hYVSfKRZ4</a> with both</li>
  </ul>