[MAPSME-4035] [ios] Added turns view shift on opened search.

This commit is contained in:
Ilya Grechuhin 2017-03-13 15:47:20 +03:00 committed by Sergey Yershov
parent 20b921782d
commit 22b34c3adf
4 changed files with 27 additions and 13 deletions

View file

@ -261,7 +261,10 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
_topBound = topBound;
if (_routePreview)
self.routePreview.topBound = topBound;
if (_navigationInfoView)
self.navigationInfoView.topBound = topBound;
}
- (void)setLeftBound:(CGFloat)leftBound
{
_leftBound = leftBound;

View file

@ -14,6 +14,7 @@ enum class NavigationSearchState
@interface MWMNavigationInfoView : UIView<MWMNavigationDashboardInfoProtocol>
@property(nonatomic) CGFloat topBound;
@property(nonatomic) CGFloat leftBound;
@property(nonatomic, readonly) CGFloat leftHeight;
@property(nonatomic, readonly) CGFloat rightHeight;

View file

@ -17,14 +17,16 @@
namespace
{
CGFloat constexpr kTurnsiPhoneWidth = 96;
CGFloat constexpr kTurnsiPadWidth = 140;
CGFloat const kTurnsiPhoneWidth = 96;
CGFloat const kTurnsiPadWidth = 140;
CGFloat constexpr kSearchButtonsViewHeightPortrait = 200;
CGFloat constexpr kSearchButtonsViewWidthPortrait = 200;
CGFloat constexpr kSearchButtonsViewHeightLandscape = 56;
CGFloat constexpr kSearchButtonsViewWidthLandscape = 286;
CGFloat constexpr kSearchButtonsSideSize = 44;
CGFloat const kSearchButtonsViewHeightPortrait = 200;
CGFloat const kSearchButtonsViewWidthPortrait = 200;
CGFloat const kSearchButtonsViewHeightLandscape = 56;
CGFloat const kSearchButtonsViewWidthLandscape = 286;
CGFloat const kSearchButtonsSideSize = 44;
CGFloat const kBaseTurnsTopOffset = 28;
CGFloat const kShiftedTurnsTopOffset = 8;
NSTimeInterval constexpr kCollapseSearchTimeout = 5.0;
@ -77,6 +79,7 @@ BOOL defaultOrientation(CGSize const & size)
@property(weak, nonatomic) IBOutlet MWMButton * searchFoodButton;
@property(weak, nonatomic) IBOutlet MWMButton * searchShopButton;
@property(weak, nonatomic) IBOutlet MWMButton * searchATMButton;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * turnsTopOffset;
@property(nonatomic, readwrite) NavigationSearchState searchState;
@property(nonatomic) BOOL isVisible;
@ -101,6 +104,7 @@ BOOL defaultOrientation(CGSize const & size)
- (void)remove { self.isVisible = NO; }
- (void)layoutSubviews
{
[super layoutSubviews];
if (!CGRectEqualToRect(self.frame, self.defaultFrame))
{
self.frame = self.defaultFrame;
@ -110,7 +114,6 @@ BOOL defaultOrientation(CGSize const & size)
if (!self.isVisible)
[self removeFromSuperview];
[super layoutSubviews];
}
- (CGFloat)leftHeight { return self.turnsView.maxY; }
@ -383,15 +386,21 @@ BOOL defaultOrientation(CGSize const & size)
- (CGRect)defaultFrame
{
return CGRectMake(self.leftBound, 0.0, self.superview.width - self.leftBound,
self.superview.height);
return {{self.leftBound, self.topBound},
{self.superview.width - self.leftBound, self.superview.height - self.topBound}};
}
- (void)setTopBound:(CGFloat)topBound
{
_topBound = MAX(topBound, 0.0);
self.turnsTopOffset.constant = topBound > 0 ? kShiftedTurnsTopOffset : kBaseTurnsTopOffset;
[self setNeedsLayout];
}
- (void)setLeftBound:(CGFloat)leftBound
{
_leftBound = MAX(leftBound, 0.0);
[self setNeedsLayout];
[self layoutIfNeeded];
}
@end

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -334,6 +334,7 @@
<outlet property="secondTurnView" destination="8Zu-Ff-6p2" id="yEK-rY-S50"/>
<outlet property="streetNameLabel" destination="ShI-bz-5g8" id="eZd-Es-g0l"/>
<outlet property="streetNameView" destination="YYv-pG-Wkw" id="gbk-SH-idq"/>
<outlet property="turnsTopOffset" destination="goU-O7-rpS" id="MEy-6X-7Qq"/>
<outlet property="turnsView" destination="Aa6-N8-acP" id="daB-uQ-UFM"/>
<outlet property="turnsWidth" destination="6Ja-Xp-g8h" id="kCr-a1-fph"/>
<outletCollection property="searchLandscapeConstraints" destination="iSp-hy-tmq" id="h2M-dj-EiD"/>