diff options
Diffstat (limited to '')
-rw-r--r-- | foray/ForayDetailViewController.swift | 18 |
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 |