Browse files

fixed the deselecting of "All Apps"

  • Loading branch information...
1 parent b9f73c3 commit c6c65418eefa6f0daee2c5ae8cd3670549d84310 Kevin Bowes committed Jun 21, 2012
Showing with 17 additions and 9 deletions.
  1. +17 −9 Classes/DashboardViewController.m
View
26 Classes/DashboardViewController.m
@@ -356,9 +356,13 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
if (cell.product) {
if (self.selectedProducts) {
- [self.selectedProducts addObject:cell.product];
+ if (![self.selectedProducts containsObject:cell.product]) {
+ [self.selectedProducts addObject:cell.product];
+ }
} else {
self.selectedProducts = [NSMutableArray arrayWithObject:cell.product];
+ NSIndexPath * indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
+ [self.productsTableView deselectRowAtIndexPath:indexPath animated:NO];
}
} else {
self.selectedProducts = nil;
@@ -384,14 +388,18 @@ - (void)deselectAllRowsInTableView:(UITableView*)tableView exceptForIndexPath:(N
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
- Product * p = [self.visibleProducts objectAtIndex:indexPath.row - 1];
-
- [self.selectedProducts removeObject:p];
-
- if ([self.selectedProducts count] == 0) {
- self.selectedProducts = nil;
- NSIndexPath * ip = [NSIndexPath indexPathForRow:0 inSection:0];
- [tableView selectRowAtIndexPath:ip animated:NO scrollPosition:UITableViewScrollPositionNone];
+ if (indexPath.row != 0) {
+ Product * p = [self.visibleProducts objectAtIndex:indexPath.row - 1];
+
+ [self.selectedProducts removeObject:p];
+
+ if ([self.selectedProducts count] == 0) {
+ self.selectedProducts = nil;
+ NSIndexPath * ip = [NSIndexPath indexPathForRow:0 inSection:0];
+ [tableView selectRowAtIndexPath:ip animated:NO scrollPosition:UITableViewScrollPositionNone];
+ }
+ } else {
+ [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
}

0 comments on commit c6c6541

Please sign in to comment.