[iOS] change separator color in PP

https://jira.mail.ru/browse/MAPSME-13445
This commit is contained in:
Aleksey Belousov 2020-04-04 11:36:12 +03:00 committed by Vladimir Byko-Ianko
parent a2eddc5c77
commit 3578aac05f
7 changed files with 22 additions and 12 deletions

View file

@ -101,7 +101,7 @@ class PlacePageStyleSheet: IStyleSheet {
}
theme.add(styleName: "PPBackgroundView") { (s) -> (Void) in
s.backgroundColor = colors.white
s.backgroundColor = colors.pressBackground
s.cornerRadius = 10
s.shadowColor = UIColor.black
s.shadowOffset = CGSize(width: 0, height: 1)

View file

@ -97,10 +97,10 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="212"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YyN-l5-4le">
<rect key="frame" x="4" y="0.0" width="367" height="42"/>
<rect key="frame" x="4" y="0.0" width="367" height="50"/>
<subviews>
<view hidden="YES" contentMode="scaleToFill" horizontalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="Jgo-Sd-tyF">
<rect key="frame" x="0.0" y="-8" width="171.5" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="171.5" height="50"/>
<subviews>
<view contentMode="scaleToFill" horizontalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="5bu-1v-9Tb">
<rect key="frame" x="0.0" y="0.0" width="171.5" height="20"/>
@ -142,13 +142,13 @@
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cafe - Wifi" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gzt-ot-sRg">
<rect key="frame" x="12" y="-8" width="343" height="50"/>
<rect key="frame" x="12" y="0.0" width="343" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view hidden="YES" contentMode="scaleToFill" horizontalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="jaa-Yj-XQR" customClass="DirectionView" customModule="maps_me" customModuleProvider="target">
<rect key="frame" x="0.0" y="-8" width="70" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="70" height="50"/>
<subviews>
<imageView autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_direction_light" translatesAutoresizingMaskIntoConstraints="NO" id="4kK-Rj-36V">
<rect key="frame" x="0.0" y="16" width="18" height="18"/>
@ -185,13 +185,13 @@
</connections>
</view>
</subviews>
<edgeInsets key="layoutMargins" top="-8" left="12" bottom="0.0" right="12"/>
<edgeInsets key="layoutMargins" top="0.0" left="12" bottom="0.0" right="12"/>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fKt-f3-qqN">
<rect key="frame" x="4" y="50" width="367" height="32"/>
<rect key="frame" x="4" y="58" width="367" height="24"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" insetsLayoutMarginsFromSafeArea="NO" text="Open" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="caI-ec-meo">
<rect key="frame" x="12" y="0.0" width="343" height="32"/>
<rect key="frame" x="12" y="0.0" width="343" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>

View file

@ -23,6 +23,7 @@ enum PlacePageState {
protocol IPlacePageLayout: class {
var presenter: PlacePagePresenterProtocol? { get set }
var header: PlacePageHeaderViewController { get }
var viewControllers: [UIViewController] { get }
var actionBar: ActionBarViewController? { get }
var navigationBar: UIViewController? { get }

View file

@ -138,7 +138,7 @@ class PlacePageCommonLayout: NSObject, IPlacePageLayout {
return vc
} ()
lazy var placePageHeaderViewController: PlacePageHeaderViewController = {
lazy var header: PlacePageHeaderViewController = {
return PlacePageHeaderBuilder.build(data: placePageData.previewData, delegate: interactor, headerType: .flexible)
} ()
@ -154,7 +154,6 @@ class PlacePageCommonLayout: NSObject, IPlacePageLayout {
private func configureViewControllers() -> [UIViewController] {
var viewControllers = [UIViewController]()
viewControllers.append(placePageHeaderViewController)
viewControllers.append(previewViewController)
if placePageData.isPromoCatalog {
viewControllers.append(catalogSingleItemViewController)

View file

@ -12,7 +12,7 @@ class PlacePageElevationLayout: IPlacePageLayout {
var navigationBar: UIViewController? = nil
var adState: AdBannerState = .unset
lazy var placePageHeaderViewController: PlacePageHeaderViewController = {
lazy var header: PlacePageHeaderViewController = {
return PlacePageHeaderBuilder.build(data: placePageData.previewData, delegate: interactor, headerType: .flexible)
} ()
@ -29,7 +29,6 @@ class PlacePageElevationLayout: IPlacePageLayout {
private func configureViewControllers() -> [UIViewController] {
var viewControllers = [UIViewController]()
viewControllers.append(placePageHeaderViewController)
viewControllers.append(elevationMapViewController)
return viewControllers

View file

@ -51,6 +51,7 @@ extension PlacePagePresenter: PlacePagePresenterProtocol {
}
func configure() {
view.addHeader(layout.header)
for viewController in layout.viewControllers {
view.addToStack(viewController)
}

View file

@ -3,6 +3,7 @@ protocol PlacePageViewProtocol: class {
var scrollView: UIScrollView! { get set }
var beginDragging: Bool { get set }
func addHeader(_ headerViewController: UIViewController)
func addToStack(_ viewController: UIViewController)
func addActionBar(_ actionBarViewController: UIViewController)
func hideActionBar(_ value: Bool)
@ -69,6 +70,15 @@ extension PlacePageViewController: PlacePageViewProtocol {
actionBarHeightConstraint.constant = !value ? kActionBarHeight : 0
}
func addHeader(_ headerViewController: UIViewController) {
addToStack(headerViewController)
// TODO: workaround. Custom spacing isn't working if visibility of any arranged subview
// changes after setting custom spacing
DispatchQueue.main.async {
self.stackView.setCustomSpacing(0, after: headerViewController.view)
}
}
func addToStack(_ viewController: UIViewController) {
addChild(viewController)
stackView.addArrangedSubview(viewController.view)