Friday, November 6, 2026
HomeiOS Developmentios - Navigation controller navigationItems would not present up as i anticipated

ios – Navigation controller navigationItems would not present up as i anticipated

[ad_1]

I comply with a video from youtube. And that i bumped into an issue when ı attempt to set Navigation Controller gadgets.

    func setupNavigationBarItems()  {
        let twitterImage = UIImageView(picture: UIImage(named: "twitter_icon"))
        twitterImage.body = CGRect(x: 0, y: 0, width: 20, top: 20)
        twitterImage.contentMode = .scaleAspectFit
        
        navigationController?.navigationItem.titleView = twitterImage
        
        let profileButton = UIButton(sort: .system)
        profileButton.setImage(UIImage(named: "profile_image"), for: .regular)
        profileButton.body = CGRect(x: 0, y: 0, width: 20, top: 20)
        navigationController?.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profileButton)
    }

End result

That is the consequence. Nothing present up

Edit–
I made similar adjustments

  navigationController?.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profileButton)

—

        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profileButton)

it simply exhibits the profileButton and button stretches throughout to the perimeters

new consequence

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments