Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Forked from prendio2/SUPTableViewController.m
Last active June 13, 2020 07:28
Show Gist options
  • Save mikeabdullah/02aaad9625362a18e101 to your computer and use it in GitHub Desktop.
Save mikeabdullah/02aaad9625362a18e101 to your computer and use it in GitHub Desktop.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
BOOL inMultipleSelectionMode = (self.tableView.editing ?
self.tableView.allowsMultipleSelectionDuringEditing :
self.tableView.allowsMultipleSelection);
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
if (selectedRowIndexPath && !inMultipleSelectionMode) {
[self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES];
[[self transitionCoordinator] notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ([context isCancelled]) {
[self.tableView selectRowAtIndexPath:selectedRowIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
}];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment