1

On iOS 7, some of my app's table view have the fade out and fade in animation on selected cell when use back gesture of navigation controller (dragging from left edge of the view to right and to left can see the cell background color changing).

But some of the table view does not have this animation, and not deselect the selected cell when dragging the view rather quickly, but can deselect cell when dragging the view slow.

zgjie
  • 2,099
  • 2
  • 21
  • 32
  • possible duplicate of [ios7 new pan gesture to go back in navigation stack does not clear tableview selection](http://stackoverflow.com/questions/19036645/ios7-new-pan-gesture-to-go-back-in-navigation-stack-does-not-clear-tableview-sel) – Pang Nov 09 '13 at 10:55

2 Answers2

1

I've been having the same problem. It appears that the code you mention can be simplified to not even check if there is a current selected row:

- (void) viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}

However I noticed that even setting animated to YES does not give the same animation with the pan back gesture as with pressing the back button.

I see that JosephH mentions in this question:

ios7 new pan gesture to go back in navigation stack does not clear tableview selection

that some of these back glitches may be getting fixed (in 7.04), but I'm still seeing the problem and I'm running 7.04. Hopefully in 7.1?

The "Clear on Appearance" attribute of the UITableViewController is supposed to clear the previously selected cell when segueing back to the TableView, but clearly this is not happening when the pan back gesture is done quickly.

Community
  • 1
  • 1
benplant
  • 11
  • 3
0

Actually this works! I just try it, it can get the animation when dragging.

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
    if (selectedRowIndexPath) {
        [self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES];
    }
}

But I still don't know why this question happen to some table view, for me it looks like the table view created after iOS 7 is ok, and the old table view created before has this question.

zgjie
  • 2,099
  • 2
  • 21
  • 32