diff --git a/Progress/PPRemindersViewController.m b/Progress/PPRemindersViewController.m index 2c7980d..86c2eca 100644 --- a/Progress/PPRemindersViewController.m +++ b/Progress/PPRemindersViewController.m @@ -130,7 +130,17 @@ static NSString *CellIdentifier = @"ReminderCell"; - (void)userPullOrDragStoppedWithPullView:(UIView *)pullView dragView:(UIView *)dragView{ if (self.pullViewShowRadio > 1) { - self.isEdingAReminder = YES; + if (!self.isEdingAReminder) { + self.isEdingAReminder = YES; + } else { + UITableViewCell *editingCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; + UITextField *editingTextField = (UITextField *)[editingCell viewWithTag:6]; + if (editingTextField.text && ![editingTextField.text isEqualToString:@""]) { + EKReminder *newReminder = [[PPEvenKitManager sharedManager] createReminderWithTitle:editingTextField.text]; + [self.remindersDatasource insertObject:newReminder atIndex:0]; + [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone]; + } + } self.pullDownView = 0; } @@ -162,7 +172,7 @@ static NSString *CellIdentifier = @"ReminderCell"; if (!textField.text || [textField.text isEqualToString:@""]) { self.isEdingAReminder = NO; [self.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationFade]; -// [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone]; + [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone]; } else { EKReminder *newReminder = [[PPEvenKitManager sharedManager] createReminderWithTitle:textField.text]; [self.remindersDatasource insertObject:newReminder atIndex:0]; @@ -188,6 +198,7 @@ static NSString *CellIdentifier = @"ReminderCell"; textField.font = [UIFont systemFontOfSize:17.f]; textField.delegate = self; textField.text = @""; + textField.tag = 6; [cell addSubview:textField]; textField.frame = CGRectMake(10, 29, 300, 21); [textField becomeFirstResponder]; diff --git a/Progress/UIScrollView+ZGPullDrag.m b/Progress/UIScrollView+ZGPullDrag.m index fc8e391..0ad5783 100644 --- a/Progress/UIScrollView+ZGPullDrag.m +++ b/Progress/UIScrollView+ZGPullDrag.m @@ -147,11 +147,13 @@ static char UIScrollViewWasDragging; [self dragViewHandler:yOffset-(self.dragView.frame.origin.y - self.frame.size.height)]; } if (self.wasDragging && !self.isDragging) { + self.wasDragging = self.isDragging; if ([self.pullDragDelegate respondsToSelector:@selector(userPullOrDragStoppedWithPullView:dragView:)]) { [self.pullDragDelegate userPullOrDragStoppedWithPullView:self.pullView dragView:self.dragView]; } + } else { + self.wasDragging = self.isDragging; } - self.wasDragging = self.isDragging; }