A
UIDatePicker
is a
view
that looked like a Las Vegas
slot machine
in iOS 6.
We usually initialize a view by passing a frame rectangle to
initWithFrame:,
but a
UIDatePicker
already has a default size of 320 × 216 pairs of pixels
(undocumented).
We could resize it with its
transform
property and
CGAffineTransformMakeScale,
but don’t.
Everyone expects that the
UIDatePicker
will remain its natural size.
We should specify only its position.
main.mDatePickerAppDelegateViewdatePickerMode
in
initWithFrame:
//so we don't have to look up the day of the week of December 31, 2014 [dateFormatter setDateStyle: NSDateFormatterLongStyle]; //so we don't have to specify a time [dateFormatter setTimeStyle: NSDateFormatterNoStyle]; datePicker.date = [dateFormatter dateFromString: @"December 31, 2014"];
valueChanged
method of class
View,
change
textView.text = [dateFormatter stringFromDate: p.date];to
NSDate *dueDate = [[NSDate alloc] initWithTimeInterval: 60 * 60 * 24 * 280 sinceDate: p.date ]; textView.text = [dateFormatter stringFromDate: dueDate];
date
property of the date picker.
initWithFrame:View
immediately after creating the picker.
AM is
Anno Mundi.
datePicker.calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSHebrewCalendar]; NSLog(@"picker.calendar.calendarIdentifier == %@", datePicker.calendar.calendarIdentifier);
2013-11-06 22:41:53.684 DatePicker[4572:a0b] picker.calendar.calendarIdentifier == hebrew