Changed menu buttons order & size.

This commit is contained in:
Ilya Grechuhin 2015-06-11 19:15:23 -07:00 committed by Alex Zolotarev
parent 46e5d5d516
commit 040745ea5b
2 changed files with 133 additions and 122 deletions

View file

@ -10,8 +10,6 @@
#import "MWMSideMenuView.h"
#import "UIKitCategories.h"
static CGSize const kBadgeSize = CGSizeMake(24.0, 24.0);
@interface MWMSideMenuView()
@property (weak, nonatomic, readwrite) IBOutlet UIView * dimBackground;
@ -50,8 +48,8 @@ static CGSize const kBadgeSize = CGSizeMake(24.0, 24.0);
- (void)awakeFromNib
{
[super awakeFromNib];
self.buttons = @[self.bookmarksButton, self.downloadMapsButton, self.settingsButton, self.shareLocationButton, self.searchButton];
self.labels = @[self.bookmarksLabel, self.downloadMapsLabel, self.settingsLabel, self.shareLocationLabel, self.searchLabel];
self.buttons = @[self.shareLocationButton, self.settingsButton, self.downloadMapsButton, self.bookmarksButton, self.searchButton];
self.labels = @[self.shareLocationLabel, self.settingsLabel, self.downloadMapsLabel, self.bookmarksLabel, self.searchLabel];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@ -109,25 +107,38 @@ static CGSize const kBadgeSize = CGSizeMake(24.0, 24.0);
CGPoint buttonCenter = CGPointMake(boundsSize.width - buttonCenterOffsetToBounds, boundsSize.height - buttonCenterOffsetToBounds);
self.searchButton.center = buttonCenter;
self.searchLabel.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.shareLocationButton.center = buttonCenter;
self.shareLocationLabel.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.settingsButton.center = buttonCenter;
self.settingsLabel.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.downloadMapsButton.center = buttonCenter;
self.downloadMapsLabel.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.bookmarksButton.center = buttonCenter;
self.bookmarksLabel.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.downloadMapsButton.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.settingsButton.center = buttonCenter;
buttonCenter.y -= offsetBetweenButtons;
self.shareLocationButton.center = buttonCenter;
self.searchLabel.height = self.searchButton.height;
self.bookmarksLabel.height = self.bookmarksButton.height;
self.downloadMapsLabel.height = self.downloadMapsButton.height;
self.settingsLabel.height = self.settingsButton.height;
self.shareLocationLabel.height = self.shareLocationButton.height;
[self.shareLocationLabel sizeToFit];
[self.settingsLabel sizeToFit];
[self.downloadMapsLabel sizeToFit];
[self.bookmarksLabel sizeToFit];
[self.searchLabel sizeToFit];
CGFloat const labelWidth = 0.5 * boundsSize.width;
self.shareLocationLabel.width = labelWidth;
self.settingsLabel.width = labelWidth;
self.downloadMapsLabel.width = labelWidth;
self.bookmarksLabel.width = labelWidth;
self.shareLocationLabel.width = MIN(labelWidth, self.shareLocationLabel.width);
self.settingsLabel.width = MIN(labelWidth, self.settingsLabel.width);
self.downloadMapsLabel.width = MIN(labelWidth, self.downloadMapsLabel.width);
self.bookmarksLabel.width = MIN(labelWidth, self.bookmarksLabel.width);
self.searchLabel.midY = self.searchButton.midY;
self.bookmarksLabel.midY = self.bookmarksButton.midY;
self.downloadMapsLabel.midY = self.downloadMapsButton.midY;
self.settingsLabel.midY = self.settingsButton.midY;
self.shareLocationLabel.midY = self.shareLocationButton.midY;
CGFloat const rightBound = self.shareLocationButton.minX - offsetLabelToButton;
self.shareLocationLabel.maxX = rightBound;

View file

@ -21,109 +21,8 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="mWD-fB-THv" userLabel="Bookmarks Label">
<rect key="frame" x="8" y="248" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Bookmarks">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmarks"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionOpenBookmarks" destination="-1" eventType="touchUpInside" id="Qch-Bf-Cpx"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="ZEc-sk-zsN" userLabel="Bookmarks">
<rect key="frame" x="256" y="248" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_bookmarks">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_bookmarks_pressed"/>
<connections>
<action selector="menuActionOpenBookmarks" destination="-1" eventType="touchUpInside" id="R4f-dp-nOX"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="joI-Q5-Iyo" userLabel="Download Label">
<rect key="frame" x="8" y="312" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Download Maps">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="download_maps"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionDownloadMaps" destination="-1" eventType="touchUpInside" id="TLT-ce-6yF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="pLL-6e-i3i" userLabel="Download">
<rect key="frame" x="256" y="312" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_download">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_download_pressed"/>
<connections>
<action selector="menuActionDownloadMaps" destination="-1" eventType="touchUpInside" id="mRz-aq-RBf"/>
</connections>
</button>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_counter" id="AIs-PS-5d2" userLabel="Download Badge">
<rect key="frame" x="288" y="312" width="24" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yPG-HI-11x" userLabel="Download Count">
<rect key="frame" x="288" y="312" width="24" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="pUg-T0-gDk" userLabel="Settings Label">
<rect key="frame" x="8" y="376" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Settings">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="settings"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionOpenSettings" destination="-1" eventType="touchUpInside" id="Ufq-ga-qXm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="78h-K2-K78" userLabel="Settings">
<rect key="frame" x="256" y="376" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_settings">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_settings_pressed"/>
<connections>
<action selector="menuActionOpenSettings" destination="-1" eventType="touchUpInside" id="kgP-17-hux"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="vKQ-Xm-fC0" userLabel="Share Label">
<rect key="frame" x="8" y="440" width="240" height="56"/>
<rect key="frame" x="8" y="248" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Share Location">
@ -141,7 +40,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="U6a-I5-v5p" userLabel="Share">
<rect key="frame" x="256" y="440" width="56" height="56"/>
<rect key="frame" x="256" y="248" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_share">
@ -152,6 +51,107 @@
<action selector="menuActionShareLocation" destination="-1" eventType="touchUpInside" id="87x-er-hhP"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="pUg-T0-gDk" userLabel="Settings Label">
<rect key="frame" x="8" y="312" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Settings">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="settings"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionOpenSettings" destination="-1" eventType="touchUpInside" id="Ufq-ga-qXm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="78h-K2-K78" userLabel="Settings">
<rect key="frame" x="256" y="312" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_settings">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_settings_pressed"/>
<connections>
<action selector="menuActionOpenSettings" destination="-1" eventType="touchUpInside" id="kgP-17-hux"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="joI-Q5-Iyo" userLabel="Download Label">
<rect key="frame" x="8" y="376" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Download Maps">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="download_maps"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionDownloadMaps" destination="-1" eventType="touchUpInside" id="TLT-ce-6yF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="pLL-6e-i3i" userLabel="Download">
<rect key="frame" x="256" y="376" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_download">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_download_pressed"/>
<connections>
<action selector="menuActionDownloadMaps" destination="-1" eventType="touchUpInside" id="mRz-aq-RBf"/>
</connections>
</button>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_counter" id="AIs-PS-5d2" userLabel="Download Badge">
<rect key="frame" x="288" y="376" width="24" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yPG-HI-11x" userLabel="Download Count">
<rect key="frame" x="288" y="376" width="24" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="mWD-fB-THv" userLabel="Bookmarks Label">
<rect key="frame" x="8" y="440" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Bookmarks">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmarks"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleLabel.numberOfLines">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionOpenBookmarks" destination="-1" eventType="touchUpInside" id="Qch-Bf-Cpx"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="ZEc-sk-zsN" userLabel="Bookmarks">
<rect key="frame" x="256" y="440" width="56" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" image="btn_green_bookmarks">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="btn_green_bookmarks_pressed"/>
<connections>
<action selector="menuActionOpenBookmarks" destination="-1" eventType="touchUpInside" id="R4f-dp-nOX"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="wordWrap" id="06v-Es-Du1" userLabel="Search Label">
<rect key="frame" x="8" y="504" width="240" height="56"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>