mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 14:13:45 +00:00
[ios] remove spacing and separator from the Track recording Place page
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
18be61e789
commit
a88798fbf2
@@ -28,6 +28,11 @@ protocol IPlacePageLayout: AnyObject {
|
||||
var bodyViewControllers: [UIViewController] { get }
|
||||
var actionBar: ActionBarViewController? { get }
|
||||
var navigationBar: UIViewController? { get }
|
||||
var sectionSpacing: CGFloat { get }
|
||||
|
||||
func calculateSteps(inScrollView scrollView: UIScrollView, compact: Bool) -> [PlacePageState]
|
||||
}
|
||||
|
||||
extension IPlacePageLayout {
|
||||
var sectionSpacing: CGFloat { return 24.0 }
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ final class PlacePageTrackRecordingLayout: IPlacePageLayout {
|
||||
return vc
|
||||
}()
|
||||
|
||||
var sectionSpacing: CGFloat { 0.0 }
|
||||
|
||||
init(interactor: PlacePageInteractor, storyboard: UIStoryboard, data: PlacePageData) {
|
||||
self.interactor = interactor
|
||||
self.storyboard = storyboard
|
||||
|
||||
@@ -176,8 +176,10 @@ final class PlacePageScrollView: UIScrollView {
|
||||
private func setupLayout(_ layout: IPlacePageLayout) {
|
||||
setLayout(layout)
|
||||
|
||||
fillHeader(with: layout.headerViewControllers)
|
||||
fillBody(with: layout.bodyViewControllers)
|
||||
let showSeparator = layout.sectionSpacing > 0
|
||||
stackView.spacing = layout.sectionSpacing
|
||||
fillHeader(with: layout.headerViewControllers, showSeparator: showSeparator)
|
||||
fillBody(with: layout.bodyViewControllers, showSeparator: showSeparator)
|
||||
|
||||
beginDragging = false
|
||||
if let actionBar = layout.actionBar {
|
||||
@@ -188,25 +190,29 @@ final class PlacePageScrollView: UIScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
private func fillHeader(with viewControllers: [UIViewController]) {
|
||||
private func fillHeader(with viewControllers: [UIViewController], showSeparator: Bool = true) {
|
||||
viewControllers.forEach { [self] viewController in
|
||||
if !stackView.arrangedSubviews.contains(headerStackView) {
|
||||
stackView.addArrangedSubview(headerStackView)
|
||||
}
|
||||
headerStackView.addArrangedSubview(viewController.view)
|
||||
}
|
||||
if showSeparator {
|
||||
headerStackView.addSeparator(.bottom)
|
||||
}
|
||||
}
|
||||
|
||||
private func fillBody(with viewControllers: [UIViewController]) {
|
||||
private func fillBody(with viewControllers: [UIViewController], showSeparator: Bool = true) {
|
||||
viewControllers.forEach { [self] viewController in
|
||||
addChild(viewController)
|
||||
stackView.addArrangedSubview(viewController.view)
|
||||
viewController.didMove(toParent: self)
|
||||
if showSeparator {
|
||||
viewController.view.addSeparator(.top)
|
||||
viewController.view.addSeparator(.bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func cleanupLayout() {
|
||||
layout?.actionBar?.view.removeFromSuperview()
|
||||
|
||||
Reference in New Issue
Block a user