ICL1901
ICL1901

Reputation: 7778

OS X NSDatePicker - how to set calendar to Today

I have a "Today" button to reset a datePicker to today's date. This works for the current month, but not for other months.

The method is:

- (IBAction)setToday:(id)sender
{
    NSLog(@"%s", __FUNCTION__);
    [datePicker setDateValue:[NSDate date]];
    [datePicker setNeedsDisplay: YES];
}

What am I doing wrong?

Upvotes: 0

Views: 811

Answers (1)

Adam Waite
Adam Waite

Reputation: 18855

I'm assuming your date picker is a property, in which case you should use the self keyword.

self.datePicker.date = [NSDate date];

Upvotes: 3

Related Questions