aboutsummaryrefslogtreecommitdiff
path: root/foray
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-03-20 13:05:29 +1100
committerNicholas Tay <nick@windblume.net>2022-03-20 13:05:29 +1100
commitccd997e3c6c4262d58b21753fd69b31ca0a601e1 (patch)
tree162b924334ed03803ef59f9a23496d6dcc856457 /foray
parent0240da96e873d8cdc1fb97a84f5e965772955e44 (diff)
downloadforayios-ccd997e3c6c4262d58b21753fd69b31ca0a601e1.tar.gz
forayios-ccd997e3c6c4262d58b21753fd69b31ca0a601e1.tar.bz2
forayios-ccd997e3c6c4262d58b21753fd69b31ca0a601e1.zip
Add ScrollView to details screen
Would make more sense as more lines get added in (especially if ui elements programatically), as well as since horizontal layout is allowed if the screen is small you can scroll
Diffstat (limited to 'foray')
-rw-r--r--foray/ForayDetailViewController.swift18
1 files changed, 14 insertions, 4 deletions
diff --git a/foray/ForayDetailViewController.swift b/foray/ForayDetailViewController.swift
index 8d0b9ec..08845df 100644
--- a/foray/ForayDetailViewController.swift
+++ b/foray/ForayDetailViewController.swift
@@ -9,7 +9,12 @@ import UIKit
class ForayDetailViewController: UIViewController {
- let container: UIView = UIView()
+ let scrollView: UIScrollView = {
+ let sv = UIScrollView()
+ sv.alwaysBounceVertical = true // just for fun
+ return sv
+ }()
+ let container = UIView()
let nameLabel: UILabel = {
let l = UILabel()
@@ -44,7 +49,8 @@ class ForayDetailViewController: UIViewController {
}
private func initialiseViews() {
- self.view.addSubview(container)
+ self.view.addSubview(scrollView)
+ scrollView.addSubview(container)
container.addSubview(nameLabel)
container.addSubview(itemImageView)
@@ -54,12 +60,16 @@ class ForayDetailViewController: UIViewController {
}
private func setupConstraints() {
- container.snp.makeConstraints { (make) in
+ scrollView.snp.makeConstraints { (make) in
make.edges.equalTo(self.view.snp.margins)
}
+ container.snp.makeConstraints { (make) in
+ make.edges.equalToSuperview()
+ make.width.equalTo(scrollView.snp.width)
+ }
nameLabel.snp.makeConstraints { (make) in
- make.top.equalToSuperview().inset(8)
+ make.top.equalToSuperview().inset(16)
make.leading.trailing.equalToSuperview().inset(8)
}
itemImageView.snp.makeConstraints { (make) in