NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

Custom (UIview)menu Bar won't show up

Forums > SwiftUI

at the moment im trying to make a custom menu bar thats designed like youtubes at the top but i cant even get the uiview to show up can somebody tell me whats wrong I am trying to get it to where it shows right under the navigationtitle(Closet)

class ClosetViewController: UIViewController, UICollectionViewDelegate {

    @IBOutlet var collectionView: UICollectionView!

        let headerId = "headerId"
        let arrImages = ["image1","image1","image1"]
    let categoryHeaderId = "categoryHeaderId"

        override func viewDidLoad() {

            navigationItem.title = "Closet"
            navigationController?.navigationBar.isTranslucent = false

            let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.width, height:view.height))
            titleLabel.text = "Closet"
            titleLabel.textColor = .white

            navigationItem.titleView = titleLabel
            collectionView.dataSource = self
            collectionView.delegate = self
            collectionView.register(ClosetCollectionViewCell.self, forCellWithReuseIdentifier: ClosetCollectionViewCell.reuseIdentifer)

            collectionView.register(ClosetReusableView.self, forSupplementaryViewOfKind: categoryHeaderId, withReuseIdentifier: headerId)
            collectionView.collectionViewLayout = createCompositionalLayout()


            let menuBar = UIView()
            menuBar.translatesAutoresizingMaskIntoConstraints = false
            menuBar.backgroundColor = .red



Hacking with Swift is sponsored by Instabug

SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred. Instabug's SDK grabs all the logs they need to fix bugs, crashes and performance issues in minutes instead of days. Get screenshots, device details, network logs, repro steps, and tons of other critical insights needed to resolve issues and prioritize product backlogs straight from your dashboard. It only takes a minute to integrate!

Get started now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.