[ios] Banner's layout fixes.

This commit is contained in:
VladiMihaylenko 2016-12-09 14:08:58 +03:00 committed by Илья Гречухин
parent fc5eb69779
commit 12e04098d1
2 changed files with 15 additions and 8 deletions

View file

@ -1,6 +1,7 @@
#import "MWMPPPreviewBannerCell.h"
#import "Common.h"
#import "MapViewController.h"
#import "MWMPlacePageLayoutImpl.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
@ -13,6 +14,8 @@ CGFloat const kPreviewImageSide = 20;
CGFloat const kOpenImageSide = 28;
CGFloat const kPreviewImageTopOffset = 8;
CGFloat const kOpenImageTopOffset = 12;
CGFloat const kParagraphSpacing = 5;
CGFloat const kLineSpacing = 5;
} // namespace
@interface MWMPPPreviewBannerCell ()
@ -53,9 +56,8 @@ CGFloat const kOpenImageTopOffset = 12;
}
auto paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.paragraphSpacing = 10;
paragraphStyle.lineSpacing = 6;
paragraphStyle.headIndent = 0;
paragraphStyle.paragraphSpacing = kParagraphSpacing;
paragraphStyle.lineSpacing = kLineSpacing;
[full addAttributes:@{NSParagraphStyleAttributeName : paragraphStyle} range:{0, full.length}];
@ -74,9 +76,6 @@ CGFloat const kOpenImageTopOffset = 12;
[self configImageInOpenState];
else
[self configImageInPreviewState];
[self setNeedsLayout];
[UIView animateWithDuration:kDefaultAnimationDuration animations:^{ [self layoutIfNeeded]; }];
}];
}
@ -102,6 +101,7 @@ CGFloat const kOpenImageTopOffset = 12;
self.bodyLeftOffset.constant = kPreviewWithImageBodyLeftOffset;
self.imageWidth.constant = self.imageHeight.constant = kPreviewImageSide;
self.imageTopOffset.constant = kPreviewImageTopOffset;
[self commitLayoutAnimated];
}
- (void)configImageInOpenState
@ -113,6 +113,13 @@ CGFloat const kOpenImageTopOffset = 12;
self.bodyLeftOffset.constant = kOpenBodyLeftOffset;
self.imageWidth.constant = self.imageHeight.constant = kOpenImageSide;
self.imageTopOffset.constant = kOpenImageTopOffset;
[self commitLayoutAnimated];
}
- (void)commitLayoutAnimated
{
[self setNeedsLayout];
[UIView animateWithDuration:place_page_layout::kAnimationSpeed animations:^{ [self layoutIfNeeded]; }];
}
- (IBAction)tap

View file

@ -59,7 +59,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="ad_message"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="advertisement"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular10"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackHintText"/>
</userDefinedRuntimeAttributes>
@ -73,6 +73,7 @@
</subviews>
<color key="backgroundColor" red="1" green="0.97254901960784312" blue="0.88235294117647056" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="kHK-5c-pds" firstAttribute="top" secondItem="V3J-j1-bTt" secondAttribute="bottom" constant="10" id="5CO-Ne-ZXe"/>
<constraint firstItem="mgh-Qm-dlV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="B4n-pp-HcL"/>
<constraint firstAttribute="trailing" secondItem="pAO-tl-o3I" secondAttribute="trailing" id="GgN-m7-bcC"/>
<constraint firstItem="zud-7e-uPx" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="JDB-MJ-CvJ"/>
@ -84,7 +85,6 @@
<constraint firstItem="V3J-j1-bTt" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="47" id="Uic-r9-8oL"/>
<constraint firstAttribute="bottom" secondItem="pAO-tl-o3I" secondAttribute="bottom" id="UuD-f3-SHD"/>
<constraint firstItem="pAO-tl-o3I" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="dyv-wR-rid"/>
<constraint firstItem="kHK-5c-pds" firstAttribute="top" secondItem="V3J-j1-bTt" secondAttribute="bottom" constant="10.5" id="evB-iU-aBn"/>
<constraint firstItem="V3J-j1-bTt" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="lMH-yl-IbR"/>
<constraint firstItem="kHK-5c-pds" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="oH2-ae-AIY"/>
<constraint firstAttribute="trailing" secondItem="V3J-j1-bTt" secondAttribute="trailing" constant="33" id="rLV-Pf-ur1"/>