user3465521
user3465521

Reputation:

Xcode logging only previously selected table view cell once a new cell is selected

I've got a table view and each time I select a new select, it logs the stats of the cell selected before it.

So let's say I select cell B, it won't log anything if that's the first cell I've selected since opening the table view. But if I then select cell A, it will log the stats of cell B.. then if I select cell C it will log cell A's stats, etc.

Any idea why?

Code below:

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

FeedItem *feedItem = [[FeedItem alloc] init];
feedItem = [self.feedItemList objectAtIndex:indexPath.row];
NSLog(@"%@ username", feedItem.username);
}

Upvotes: 0

Views: 61

Answers (1)

Stonz2
Stonz2

Reputation: 6396

Wrong method. You want didSelectRowAtIndexPath. Yours is Deselect instead of Select

Upvotes: 2

Related Questions