mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-25 09:25:47 +00:00
fix clearing post selection on compact horiz layouts
This commit is contained in:
parent
a50dfc9a1c
commit
4ce730490c
2 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue