Skip to content
Permalink
Browse files

Make the table view go all the way to the top, be transparent and hav…

…e a top content inset
  • Loading branch information...
skagedal committed Jul 30, 2018
1 parent 4085baf commit 229c5955b4b7364208a3313539955cd392cbfe5d
@@ -4,8 +4,6 @@
import UIKit

private let maxVisibleContentHeight: CGFloat = 400

class BottomSheetContainerView: UIView {

private let mainView: UIView
@@ -33,13 +31,13 @@ class BottomSheetContainerView: UIView {
mainView.bottomAnchor.constraint(equalTo: bottomAnchor)
])

// The sheet starts after an overlap
// The sheet table view goes all the way up to the status bar
addSubview(sheetView)
sheetView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
sheetView.leftAnchor.constraint(equalTo: leftAnchor),
sheetView.rightAnchor.constraint(equalTo: rightAnchor),
sheetView.topAnchor.constraint(equalTo: topAnchor, constant: maxVisibleContentHeight),
sheetView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
sheetView.bottomAnchor.constraint(equalTo: bottomAnchor),
])
}
@@ -4,6 +4,8 @@
import UIKit

private let maxVisibleContentHeight: CGFloat = 400

private let numberOfCountries = 20
private let countries = Locale.isoRegionCodes.prefix(numberOfCountries).map(Locale.current.localizedString(forRegionCode:))
private let reuseIdentifier = "cell"
@@ -14,6 +16,10 @@ class CountriesTableViewController: UITableViewController {
super.viewDidLoad()

tableView.register(UITableViewCell.self, forCellReuseIdentifier: reuseIdentifier)

tableView.contentInset.top = maxVisibleContentHeight
tableView.backgroundColor = .clear
tableView.showsVerticalScrollIndicator = false
}

// MARK: - Table view data source

0 comments on commit 229c595

Please sign in to comment.
You can’t perform that action at this time.