forked from organicmaps/organicmaps
[ios] Fixed content inset on iPad
This commit is contained in:
parent
690b6b8e8a
commit
9de3f407e7
3 changed files with 73 additions and 12 deletions
|
@ -52,7 +52,7 @@
|
|||
|
||||
- (void)backTap
|
||||
{
|
||||
[self.iPadOwnerNavigationController popViewControllerAnimated:YES];
|
||||
[self popViewController];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
|
@ -137,10 +137,28 @@
|
|||
{
|
||||
[self moveBookmarkToSetWithIndex:static_cast<int>(indexPath.row)];
|
||||
[self.manager reloadBookmark];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
[self popViewController];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)popViewController
|
||||
{
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
[UIView animateWithDuration:0.1 animations:^
|
||||
{
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
|
@ -148,7 +166,6 @@
|
|||
return;
|
||||
|
||||
self.iPadOwnerNavigationController.navigationBar.hidden = YES;
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -58,7 +58,7 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
|
||||
- (void)backTap
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
[self popViewController];
|
||||
}
|
||||
|
||||
- (void)configureTableViewForOrientation:(UIInterfaceOrientation)orientation
|
||||
|
@ -110,6 +110,24 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)popViewController
|
||||
{
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
[UIView animateWithDuration:0.1 animations:^
|
||||
{
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
|
@ -119,7 +137,6 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
return;
|
||||
}
|
||||
self.iPadOwnerNavigationController.navigationBar.hidden = YES;
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -96,6 +96,7 @@ static CGFloat const kBottomOffset = 12.;
|
|||
self.anchorImageView.image = nil;
|
||||
self.anchorImageView.backgroundColor = [UIColor whiteColor];
|
||||
self.actionBar.width = defaultWidth;
|
||||
[self configureContentInset];
|
||||
}
|
||||
|
||||
- (void)show
|
||||
|
@ -140,15 +141,19 @@ static CGFloat const kBottomOffset = 12.;
|
|||
- (void)addBookmark
|
||||
{
|
||||
[super addBookmark];
|
||||
self.height += kBookmarkCellHeight;
|
||||
self.actionBar.minY += kBookmarkCellHeight;
|
||||
[UIView animateWithDuration:0.1 animations:^
|
||||
{
|
||||
[self updatePlacePageLayout];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)removeBookmark
|
||||
{
|
||||
[super removeBookmark];
|
||||
self.height -= kBookmarkCellHeight;
|
||||
self.actionBar.minY -= kBookmarkCellHeight;
|
||||
[UIView animateWithDuration:0.1 animations:^
|
||||
{
|
||||
[self updatePlacePageLayout];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)changeBookmarkColor
|
||||
|
@ -204,8 +209,30 @@ static CGFloat const kBottomOffset = 12.;
|
|||
|
||||
- (void)updatePlacePagePosition
|
||||
{
|
||||
self.navigationController.view.maxY = [self availableHeight] + kTopOffset;
|
||||
self.navigationController.view.minY = MIN(self.navigationController.view.minY, self.topBound + kTopOffset);
|
||||
UIView * view = self.navigationController.view;
|
||||
view.maxY = self.availableHeight + kTopOffset;
|
||||
view.minY = MIN(view.minY, self.topBound + kTopOffset);
|
||||
[self configureContentInset];
|
||||
}
|
||||
|
||||
- (void)configureContentInset
|
||||
{
|
||||
UITableView * featureTable = self.basePlacePageView.featureTable;
|
||||
CGFloat const height = self.navigationController.view.height;
|
||||
CGFloat const tableContentHeight = featureTable.contentSize.height;
|
||||
CGFloat const headerViewHeight = self.basePlacePageView.separatorView.maxY;
|
||||
CGFloat const availableTableHeight = height - headerViewHeight - self.actionBar.height;
|
||||
CGFloat const externalHeight = tableContentHeight - availableTableHeight;
|
||||
if (externalHeight > 0.)
|
||||
{
|
||||
featureTable.contentInset = UIEdgeInsetsMake(0., 0., externalHeight, 0.);
|
||||
featureTable.scrollEnabled = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
[featureTable setContentOffset:CGPointZero animated:YES];
|
||||
featureTable.scrollEnabled = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (CGFloat)availableHeight
|
||||
|
@ -217,7 +244,7 @@ static CGFloat const kBottomOffset = 12.;
|
|||
|
||||
- (void)setHeight:(CGFloat)height
|
||||
{
|
||||
_height = MIN(height, [self availableHeight]);
|
||||
_height = MIN(height, self.availableHeight);
|
||||
self.navigationController.view.height = _height;
|
||||
self.extendedPlacePageView.height = _height;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue