Fixed issue #330 with countdown timer. It did not check the first change.

This commit is contained in:
Mathias Claassen
2015-04-22 14:57:18 -03:00
parent 6e5427d7a4
commit 8bbbef613b
2 changed files with 12 additions and 5 deletions
@@ -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"
+3 -3
View File
@@ -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<XLFormInlineRowDescriptorCell> * inlineCell = (UITableViewCell<XLFormInlineRowDescriptorCell> *)datePickerCell;