diff --git a/BetteReddit/Controller/PostListViewController.m b/BetteReddit/Controller/PostListViewController.m index 87f9c5c..fa964d8 100644 --- a/BetteReddit/Controller/PostListViewController.m +++ b/BetteReddit/Controller/PostListViewController.m @@ -53,6 +53,12 @@ - (void)viewDidLoad { -(void)changedSubreddit:(NSNotification *)notification{ self.current = notification.object; + NSInteger selection = self.postListView.selectedRow; + if(selection != -1){ + PostTableViewCell *row = [self.postListView viewAtColumn:0 row:selection makeIfNecessary:false]; + row.isSelected = false; + row.needsDisplay = true; + } [self.current loadMoreSubredditPosts:false onComplete:^(NSArray * _Nullable newPosts){ dispatch_async(dispatch_get_main_queue(),^(void){ [self.postListView reloadData]; @@ -97,6 +103,8 @@ - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row{ - (void)tableViewSelectionDidChange:(NSNotification *)notification{ NSInteger selection = self.postListView.selectedRow; + if(selection == -1) + return; PostTableViewCell *row = [self.postListView viewAtColumn:0 row:selection makeIfNecessary:false]; row.isSelected = true; row.needsDisplay = true;