diff --git a/Examples/Objective-C/Examples/Dates/DatesFormViewController.m b/Examples/Objective-C/Examples/Dates/DatesFormViewController.m index 5cd9a0d..371b2a2 100644 --- a/Examples/Objective-C/Examples/Dates/DatesFormViewController.m +++ b/Examples/Objective-C/Examples/Dates/DatesFormViewController.m @@ -71,7 +71,13 @@ NSString *const kCountDownTimer = @"countDownTimer"; // CountDownTimer row = [XLFormRowDescriptor formRowDescriptorWithTag:kCountDownTimerInline rowType:XLFormRowDescriptorTypeCountDownTimerInline title:@"Countdown Timer"]; - row.value = [NSDate new]; + NSDateComponents * dateComp = [NSDateComponents new]; + dateComp.hour = 0; + dateComp.minute = 7; + dateComp.timeZone = [NSTimeZone systemTimeZone]; + NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + + row.value = [calendar dateFromComponents:dateComp]; [section addFormRow:row]; @@ -98,7 +104,7 @@ NSString *const kCountDownTimer = @"countDownTimer"; // CountDownTimer row = [XLFormRowDescriptor formRowDescriptorWithTag:kCountDownTimerInline rowType:XLFormRowDescriptorTypeCountDownTimer title:@"Countdown Timer"]; - row.value = [NSDate new]; + row.value = [calendar dateFromComponents:dateComp]; [section addFormRow:row]; section = [XLFormSectionDescriptor formSectionWithTitle:@"Disabled Dates"]; @@ -148,6 +154,7 @@ NSString *const kCountDownTimer = @"countDownTimer"; -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue { + [super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue]; if([formRow.tag isEqualToString:kDatePicker]) { UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker" diff --git a/XLForm/XL/Cell/XLFormDateCell.m b/XLForm/XL/Cell/XLFormDateCell.m index 4596a63..278f2df 100644 --- a/XLForm/XL/Cell/XLFormDateCell.m +++ b/XLForm/XL/Cell/XLFormDateCell.m @@ -44,7 +44,7 @@ { if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDate] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeTime] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDateTime] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimer]){ if (self.rowDescriptor.value){ - [self.datePicker setDate:self.rowDescriptor.value]; + [self.datePicker setDate:self.rowDescriptor.value animated:[self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimer]]; } [self setModeToDatePicker:self.datePicker]; return self.datePicker; @@ -70,8 +70,8 @@ XLFormRowDescriptor * datePickerRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeDatePicker]; XLFormDatePickerCell * datePickerCell = (XLFormDatePickerCell *)[datePickerRowDescriptor cellForFormController:self.formViewController]; [self setModeToDatePicker:datePickerCell.datePicker]; - if (self.rowDescriptor.value){ - [datePickerCell.datePicker setDate:self.rowDescriptor.value]; + if (self.rowDescriptor.value){ + [datePickerCell.datePicker setDate:self.rowDescriptor.value animated:[self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimerInline]]; } NSAssert([datePickerCell conformsToProtocol:@protocol(XLFormInlineRowDescriptorCell)], @"inline cell must conform to XLFormInlineRowDescriptorCell"); UITableViewCell * inlineCell = (UITableViewCell *)datePickerCell;