fix clearing post selection on compact horiz layouts

This commit is contained in:
Sami Samhuri 2015-06-28 13:29:54 -07:00
parent a50dfc9a1c
commit 4ce730490c
2 changed files with 10 additions and 2 deletions

View file

@ -22,8 +22,17 @@
self.postsViewController.preferredContentSize = CGSizeMake(320, 600);
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self updateForNewTraitCollection:self.traitCollection];
}
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator {
[super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
[self updateForNewTraitCollection:newCollection];
}
- (void)updateForNewTraitCollection:(UITraitCollection *)newCollection {
BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact;
self.postsViewController.clearsSelectionOnViewWillAppear = isCompact;
}

View file

@ -194,8 +194,7 @@ static const NSUInteger SectionPublished = 1;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self requestStatusWithCaching:YES];
BOOL isPhone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone;
if (isPhone && self.tableView.indexPathForSelectedRow) {
if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) {
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
}
if (!self.postCollections) {