From 019310f284154492e372575f07a15183d7d91b1d Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 7 Sep 2016 22:50:21 -0400 Subject: [PATCH] Deselect table rows when swiping back in table views // FREEBIE --- .../OWSLinkedDevicesTableViewController.m | 3 +++ Signal/src/view controllers/SettingsTableViewController.m | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m b/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m index a36708d6a..e319e9d39 100644 --- a/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m +++ b/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m @@ -65,6 +65,9 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1; { [super viewWillAppear:animated]; [self refreshDevices]; + // HACK to unselect rows when swiping back + // http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly + [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated]; } - (void)viewWillDisappear:(BOOL)animated diff --git a/Signal/src/view controllers/SettingsTableViewController.m b/Signal/src/view controllers/SettingsTableViewController.m index ad0541618..34fd0a599 100644 --- a/Signal/src/view controllers/SettingsTableViewController.m +++ b/Signal/src/view controllers/SettingsTableViewController.m @@ -85,6 +85,14 @@ typedef enum { forState:UIControlStateNormal]; } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + // HACK to unselect rows when swiping back + // http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly + [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated]; +} + - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:SocketOpenedNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:SocketClosedNotification object:nil];