mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-04-27 15:07:44 +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);
|
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 {
|
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator {
|
||||||
[super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
|
[super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
|
||||||
|
[self updateForNewTraitCollection:newCollection];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateForNewTraitCollection:(UITraitCollection *)newCollection {
|
||||||
BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact;
|
BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact;
|
||||||
self.postsViewController.clearsSelectionOnViewWillAppear = isCompact;
|
self.postsViewController.clearsSelectionOnViewWillAppear = isCompact;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,7 @@ static const NSUInteger SectionPublished = 1;
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
[self requestStatusWithCaching:YES];
|
[self requestStatusWithCaching:YES];
|
||||||
BOOL isPhone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone;
|
if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) {
|
||||||
if (isPhone && self.tableView.indexPathForSelectedRow) {
|
|
||||||
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
|
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
|
||||||
}
|
}
|
||||||
if (!self.postCollections) {
|
if (!self.postCollections) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue