From 1f549845424a3295343c7613ff9bc98b102417d6 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:53:44 -0700 Subject: [PATCH] improve post selection handling --- Blog/PostsViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index 0ce1f7d..f1c91ce 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -195,15 +195,15 @@ static const NSUInteger SectionPublished = 1; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self requestStatusWithCaching:YES]; - if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { - [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; - } PMKPromise *postP = self.postCollections ? [PMKPromise promiseWithValue:self.postCollections] : [self requestPostsWithCaching:YES]; postP.then(^{ if (self.selectedIndexPath && [self postForIndexPath:self.selectedIndexPath]) { [self.tableView selectRowAtIndexPath:self.selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle]; self.selectedIndexPath = nil; } + if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { + [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; + } }); }