forked from organicmaps/organicmaps
[ios] Fixed menu layout bugs.
This commit is contained in:
parent
a3aad61d49
commit
628476581b
2 changed files with 16 additions and 9 deletions
|
@ -62,13 +62,17 @@
|
|||
- (void)layoutXPosition:(BOOL)hidden
|
||||
{
|
||||
if (hidden)
|
||||
{
|
||||
self.minX = self.superview.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.maxX = self.superview.width - 2.0 * kViewControlsOffsetToBounds;
|
||||
|
||||
m2::PointD const pivot(self.minX * self.contentScaleFactor - 2.0 * kViewControlsOffsetToBounds, self.maxY * self.contentScaleFactor - kViewControlsOffsetToBounds);
|
||||
[self.delegate setRulerPivot:pivot];
|
||||
[self.delegate setCopyrightLabelPivot:pivot];
|
||||
|
||||
m2::PointD const pivot(self.minX * self.contentScaleFactor - 2.0 * kViewControlsOffsetToBounds, self.maxY * self.contentScaleFactor - kViewControlsOffsetToBounds);
|
||||
[self.delegate setRulerPivot:pivot];
|
||||
[self.delegate setCopyrightLabelPivot:pivot];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
@ -95,6 +99,7 @@
|
|||
else
|
||||
{
|
||||
self.hidden = hidden;
|
||||
[self layoutXPosition:hidden];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,13 +83,15 @@
|
|||
- (CGFloat)offsetBetweenButtons
|
||||
{
|
||||
CGFloat offset = 66.0;
|
||||
CGFloat const buttonWidth = self.size.width;
|
||||
CGFloat const buttonHeight = self.size.height;
|
||||
if (buttonWidth > buttonHeight)
|
||||
CGFloat const menuWidth = self.size.width;
|
||||
CGFloat const menuHeight = self.size.height;
|
||||
if (menuWidth > menuHeight)
|
||||
{
|
||||
CGFloat const statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
NSUInteger const buttonsCount = self.buttons.count;
|
||||
CGFloat const buttonCenterOffsetToBounds = 0.5 * self.searchButton.height + 2.0 * kViewControlsOffsetToBounds;
|
||||
offset = MIN(offset, (buttonHeight - 2.0 * (buttonCenterOffsetToBounds - 0.5 * buttonHeight) - buttonsCount*buttonHeight) / (buttonsCount - 1) + buttonHeight);
|
||||
CGFloat const buttonHeight = self.searchButton.height;
|
||||
CGFloat const buttonCenterOffsetToBounds = 0.5 * buttonHeight + 2.0 * kViewControlsOffsetToBounds;
|
||||
offset = MIN(offset, (menuHeight - 0.5 * statusBarHeight - 2.0 * (buttonCenterOffsetToBounds - 0.5 * buttonHeight) - buttonsCount*buttonHeight) / (buttonsCount - 1) + buttonHeight);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue