0

So I have an app that contains a tableView. When you press on a row, it should go to a new view controller and transfer the results. But it only sort-of works. If you press on a row, it will stay selected (Highlighted blue), but then if you select a different row, it will release the press on the first row and then move to the corresponding view. Sorry if this is a little confusing. Here is a short video of the error --> http://vid.ly/1e8u0h

It would seem as though the problem is that when I tap on a row, it never sends the "tap up" action, therefore doesn't continue with this method :

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{

    DetailViewController *detailViewController = [[DetailViewController alloc] init];

    NSArray *items = [[BNRItemStore sharedStore] allItems];
    BNRItem *selectedItem = [items objectAtIndex:[indexPath row]];

    [detailViewController setItem:selectedItem];

    [[self navigationController] pushViewController:detailViewController animated:YES];
}

How do I fix this? Thanks.

Josiah
  • 4,663
  • 2
  • 31
  • 49

2 Answers2

2

You're using didDeselectRowAtIndexPath instead of didSelectRowAtIndexPath :) Easy fix. Happy Coding.

Ryan Poolos
  • 18,421
  • 4
  • 65
  • 98
2

You schould use tableview:didSelectRowAtIndexPath instead of tableView:didDeselectRowAtIndexPath.

gamma
  • 1,902
  • 1
  • 20
  • 40