Skip to content
This repository has been archived by the owner on Nov 1, 2017. It is now read-only.

Commit

Permalink
Revert "select the table view row regardless of whether it was alread…
Browse files Browse the repository at this point in the history
…y selected"

This reverts commit 7839383.
  • Loading branch information
joshaber committed Oct 21, 2011
1 parent abfe398 commit 39ad7cb
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/UIKit/TUITableView.m
Expand Up @@ -1093,17 +1093,23 @@ - (void)_makeRowAtIndexPathFirstResponder:(TUIFastIndexPath *)indexPath

- (void)selectRowAtIndexPath:(TUIFastIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(TUITableViewScrollPosition)scrollPosition
{
[self deselectRowAtIndexPath:[self indexPathForSelectedRow] animated:animated];

if([indexPath isEqual:[self indexPathForSelectedRow]]) {
// just scroll to visible
} else {
[self deselectRowAtIndexPath:[self indexPathForSelectedRow] animated:animated];

TUITableViewCell *cell = [self cellForRowAtIndexPath:indexPath]; // may be nil
[cell setSelected:YES animated:animated];
[_selectedIndexPath release]; // should already be nil
_selectedIndexPath = [indexPath retain];
[cell setNeedsDisplay];

// only notify when the selection actually changes
if([self.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){
[self.delegate tableView:self didSelectRowAtIndexPath:indexPath];
}

TUITableViewCell *cell = [self cellForRowAtIndexPath:indexPath]; // may be nil
[cell setSelected:YES animated:animated];
[_selectedIndexPath release]; // should already be nil
_selectedIndexPath = [indexPath retain];
[cell setNeedsDisplay];

// only notify when the selection actually changes
if(![indexPath isEqual:[self indexPathForSelectedRow]] && [self.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){
[self.delegate tableView:self didSelectRowAtIndexPath:indexPath];
}

[self _makeRowAtIndexPathFirstResponder:indexPath];
Expand Down

0 comments on commit 39ad7cb

Please sign in to comment.