Swift Parchment library, menu bar doesnt show up

743 views Asked by At

so i making this feature and im using Parchment pod

and i somehow the menu bar doesnt show up, but i can swipe horizontally

*im using storyboard method

this is my code :

import UIKit
import Parchment


 class ParchmentController: UIViewController{

override func viewDidLoad() {
    super.viewDidLoad()
    
    let storyBoardd = UIStoryboard(name: "Main", bundle: nil)
    let semua = storyBoardd.instantiateViewController(identifier: SemuaController.identfier)
    let kesehatan = storyBoardd.instantiateViewController(identifier: KesehatanController.identifier)
    let FB = storyBoardd.instantiateViewController(identifier: F_BController.identifier)
    let pelumas = storyBoardd.instantiateViewController(identifier: PelumasController.identifier)
    let bbm = storyBoardd.instantiateViewController(identifier: BbmVoucherController.identifier)
    let entertainment = storyBoardd.instantiateViewController(identifier: EntertaimentController.identfier)
    
     let vc = [
        semua,
        kesehatan,
        FB,
        pelumas,
        bbm,
        entertainment
     ]
    
    let pagingViewController = PagingViewController(viewControllers: vc)

    addChild(pagingViewController)
    view.addSubview(pagingViewController.view)
    view.constrainToEdges(pagingViewController.view)
    pagingViewController.didMove(toParent: self)
    pagingViewController.menuItemSize = .sizeToFit(minWidth: 150, height: 40)
    
  }
} 

  extension UIView {



func constrainToEdges(_ subview: UIView) {

subview.translatesAutoresizingMaskIntoConstraints = false

let topContraint = NSLayoutConstraint(
  item: subview,
  attribute: .top,
  relatedBy: .equal,
  toItem: self,
  attribute: .top,
  multiplier: 1.0,
  constant: 0)

let bottomConstraint = NSLayoutConstraint(
  item: subview,
  attribute: .bottom,
  relatedBy: .equal,
  toItem: self,
  attribute: .bottom,
  multiplier: 1.0,
  constant: 0)

let leadingContraint = NSLayoutConstraint(
  item: subview,
  attribute: .leading,
  relatedBy: .equal,
  toItem: self,
  attribute: .leading,
  multiplier: 1.0,
  constant: 0)

let trailingContraint = NSLayoutConstraint(
  item: subview,
  attribute: .trailing,
  relatedBy: .equal,
  toItem: self,
  attribute: .trailing,
  multiplier: 1.0,
  constant: 0)

addConstraints([
  topContraint,
  bottomConstraint,
  leadingContraint,
  trailingContraint])
  }
 }

and when i build it came up like this

enter image description here

as you can see theres no menu bar on top, i can still swipe horizontally but still i though when i set PagingViewController it automatically setup the menu bar.

can someone help with, anyone already using this pod before?

thanks

  • yeah i know the constraint of that CollectionView cell kinda mess up
0

There are 0 answers