Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidLoad() {
- super.viewDidLoad()
- setupCollectionViewLayout()
- setupCollectionView()
- setupMenuBar()
- }
- var headerView: HeaderView?
- fileprivate func setupCollectionViewLayout() {
- if let layout = collectionViewLayout as? UICollectionViewFlowLayout {
- layout.sectionInset = .init(top: padding, left: padding, bottom: padding, right: padding)
- }
- }
- fileprivate func setupCollectionView() {
- self.collectionView.backgroundColor = .white
- //For iPhone X's make sure it doesn't cover the swipe bar at bottom
- self.collectionView.contentInsetAdjustmentBehavior = .never
- // Register cell classes
- self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: cellId)
- self.collectionView.register(HeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: headerId)
- self.collectionView.contentInset = UIEdgeInsets(top: 60, left: 0, bottom: 0, right: 0)
- self.collectionView?.scrollIndicatorInsets = UIEdgeInsets(top: 60, left: 0, bottom: 0, right: 0)
- }
- let menuBar: MenuBar = {
- let mb = MenuBar()
- return mb
- }()
- fileprivate func setupMenuBar() {
- view.addSubview(menuBar)
- view.addConstraintWithFormat(format: "H:|[v0]|", views: menuBar)
- view.addConstraintWithFormat(format: "V:|-400-[v0(50)]|", views: menuBar)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement