Commit b0b13c12 by Dmitriy Stepanets

Added scrolling behavior for legend view

parent f6a6422b
......@@ -12,7 +12,7 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>37</integer>
</dict>
<key>PG (Playground) 1.xcscheme</key>
<dict>
......
......@@ -119,13 +119,12 @@ public enum SevereLayerType:String, CaseIterable, RadarLayerType {
UIColor(hex: 0x7F1819),
UIColor(hex: 0xF0807F)].map{$0.cgColor}
case .hurricaneTropicalTracks:
return [UIColor.black,
UIColor.black,
UIColor.black,
UIColor.black,
UIColor.black,
UIColor.black,
UIColor.black].map{$0.cgColor}
return [UIColor(hex: 0x61bb46),
UIColor(hex: 0xfdb827),
UIColor(hex: 0xf5821f),
UIColor(hex: 0xe03a3e),
UIColor(hex: 0x963d97),
UIColor(hex: 0x009ddc)].map{$0.cgColor}
case .ice:
return [UIColor(hex: 0x8A008B),
UIColor(hex: 0x8A008B),
......
......@@ -9,6 +9,7 @@ import UIKit
class MapLegendSevereView: UIView {
//Private
private let scrollView = UIScrollView()
private let stackView = UIStackView()
init() {
......@@ -37,13 +38,22 @@ class MapLegendSevereView: UIView {
}
private func prepare() {
scrollView.showsVerticalScrollIndicator = false
scrollView.showsHorizontalScrollIndicator = false
scrollView.clipsToBounds = false
addSubview(scrollView)
scrollView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
stackView.axis = .horizontal
stackView.spacing = 8
stackView.distribution = .equalSpacing
addSubview(stackView)
stackView.distribution = .fillEqually
scrollView.addSubview(stackView)
stackView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
make.edges.height.equalToSuperview()
make.centerX.equalToSuperview().priority(.low)
}
}
}
......@@ -78,8 +88,7 @@ private class SevereLegendElement:UIView {
private func prepare() {
self.snp.makeConstraints { (make) in
make.width.equalTo(50).priority(999)
make.height.equalTo(40)
make.width.equalTo(50)
}
imageView.clipsToBounds = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment