[iphonex] [ios] Extended action bar buttons background for custom cells.

This commit is contained in:
Ilya Grechuhin 2018-01-10 16:36:12 +03:00 committed by Roman Kuznetsov
parent d6d805c5fc
commit 7adf2f3d0c
2 changed files with 35 additions and 5 deletions

View file

@ -48,6 +48,7 @@ NSString * titleForButton(EButton type, BOOL isSelected)
@property (nonatomic) EButton type;
@property(nonatomic) MWMCircularProgress * mapDownloadProgress;
@property(nonatomic) UIView * progressWrapper;
@property(weak, nonatomic) IBOutlet UIView * extraBackground;
@end
@ -63,6 +64,7 @@ NSString * titleForButton(EButton type, BOOL isSelected)
- (void)configButton:(BOOL)isSelected
{
self.label.text = titleForButton(self.type, isSelected);
self.extraBackground.hidden = YES;
switch (self.type)
{
case EButton::Api:
@ -90,16 +92,31 @@ NSString * titleForButton(EButton type, BOOL isSelected)
[self.button setImage:[UIImage imageNamed:@"ic_booking_logo"] forState:UIControlStateNormal];
self.label.textColor = UIColor.whiteColor;
self.backgroundColor = [UIColor bookingBackground];
if (!IPAD)
{
self.extraBackground.backgroundColor = [UIColor bookingBackground];
self.extraBackground.hidden = NO;
}
break;
case EButton::BookingSearch:
[self.button setImage:[UIImage imageNamed:@"ic_booking_search"] forState:UIControlStateNormal];
self.label.textColor = UIColor.whiteColor;
self.backgroundColor = [UIColor bookingBackground];
if (!IPAD)
{
self.extraBackground.backgroundColor = [UIColor bookingBackground];
self.extraBackground.hidden = NO;
}
break;
case EButton::Opentable:
[self.button setImage:[UIImage imageNamed:@"ic_opentable"] forState:UIControlStateNormal];
self.label.textColor = UIColor.whiteColor;
self.backgroundColor = [UIColor opentableBackground];
if (!IPAD)
{
self.extraBackground.backgroundColor = [UIColor opentableBackground];
self.extraBackground.hidden = NO;
}
break;
case EButton::Call:
[self.button setImage:[UIImage imageNamed:@"ic_placepage_phone_number"] forState:UIControlStateNormal];

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" 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="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMActionBarButton"/>
@ -11,6 +15,10 @@
<rect key="frame" x="0.0" y="0.0" width="80" height="48"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="R50-Tj-X0W">
<rect key="frame" x="-100" y="0.0" width="180" height="48"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W07-Hz-J60" customClass="MWMButton">
<rect key="frame" x="0.0" y="2" width="80" height="33"/>
<constraints>
@ -29,7 +37,7 @@
<constraint firstAttribute="height" constant="14" id="BBl-pC-RJq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
@ -37,13 +45,17 @@
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="R50-Tj-X0W" secondAttribute="trailing" id="2jF-U9-Gei"/>
<constraint firstAttribute="trailing" secondItem="rrI-0A-w3s" secondAttribute="trailing" id="LPs-Yx-xz6"/>
<constraint firstItem="rrI-0A-w3s" firstAttribute="top" secondItem="W07-Hz-J60" secondAttribute="bottom" constant="-3" id="SMD-s3-Tz5"/>
<constraint firstItem="W07-Hz-J60" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="2" id="UJy-Ef-B7E"/>
<constraint firstItem="rrI-0A-w3s" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="X6f-tU-o9a"/>
<constraint firstItem="R50-Tj-X0W" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ZHQ-XD-E90"/>
<constraint firstAttribute="bottom" secondItem="rrI-0A-w3s" secondAttribute="bottom" constant="2" id="Zsi-G2-yc8"/>
<constraint firstAttribute="bottom" secondItem="R50-Tj-X0W" secondAttribute="bottom" id="adE-76-Hab"/>
<constraint firstItem="R50-Tj-X0W" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="-100" id="qid-13-F5b"/>
<constraint firstItem="W07-Hz-J60" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="rBR-of-5Ha"/>
<constraint firstAttribute="trailing" secondItem="W07-Hz-J60" secondAttribute="trailing" id="teM-gm-CX7"/>
</constraints>
@ -51,6 +63,7 @@
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="button" destination="W07-Hz-J60" id="dAN-CS-btL"/>
<outlet property="extraBackground" destination="R50-Tj-X0W" id="c90-1d-BSU"/>
<outlet property="label" destination="rrI-0A-w3s" id="LMD-pz-agZ"/>
</connections>
</view>