Skip to content

Commit

Permalink
respect the safe layout area
Browse files Browse the repository at this point in the history
  • Loading branch information
theospears committed Dec 26, 2024
1 parent 9a9df0f commit d3d4f19
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions BeeSwift/Gallery/GalleryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class GalleryViewController: UIViewController, UICollectionViewDelegateFlowLayou
let logger = Logger(subsystem: "com.beeminder.beeminder", category: "GalleryViewController")

var stackView = UIStackView()
var collectionContainer = UIView()
var collectionView :UICollectionView?
var collectionViewLayout :UICollectionViewFlowLayout?
let lastUpdatedView = UIView()
Expand Down Expand Up @@ -50,11 +51,10 @@ class GalleryViewController: UIViewController, UICollectionViewDelegateFlowLayou
stackView.alignment = .fill
stackView.distribution = .fill
stackView.spacing = 0
stackView.insetsLayoutMarginsFromSafeArea = true
stackView.snp.makeConstraints { (make) -> Void in
make.top.left.right.equalTo(self.view.safeAreaLayoutGuide)
// We are happy for the bottom of the scrollview to be partially obscured by the
// home indicator. This looks better than a bit white area at the bottom.
make.bottom.equalTo(self.view)
make.top.left.right.equalToSuperview()
make.bottom.equalTo(stackView.keyboardLayoutGuide.snp.top)
}

self.collectionViewLayout = UICollectionViewFlowLayout()
Expand Down Expand Up @@ -131,10 +131,16 @@ class GalleryViewController: UIViewController, UICollectionViewDelegateFlowLayou
self.searchBar.isHidden = true
self.searchBar.showsCancelButton = true

stackView.addArrangedSubview(self.collectionContainer)

self.collectionContainer.addSubview(self.collectionView!)
self.collectionView!.delegate = self
self.collectionView!.dataSource = self
self.collectionView!.register(GoalCollectionViewCell.self, forCellWithReuseIdentifier: self.cellReuseIdentifier)
stackView.addArrangedSubview(self.collectionView!)
self.collectionView?.snp.makeConstraints { (make) in
make.top.bottom.equalTo(collectionContainer)
make.left.right.equalTo(collectionContainer.safeAreaLayoutGuide)
}

self.collectionView?.refreshControl = {
let refreshControl = UIRefreshControl()
Expand Down

0 comments on commit d3d4f19

Please sign in to comment.