UINavigationBar: Change the color & font in swift 5

UINavigationBar: Change the color & font in swift 5
May 23, 2020 No Comments Development,iOS Development Pushpendra Kumar

Hey Guys, In this tutorial you will learn a very important trick. Here I will tell you how you can Customize UINavigationBar in Swift 5 programming language. The two main important topics you will understand into the complete entire tutorial. The first topic is how you can change the navigation bar color and text color. Then second thing is that, How you can change the title font type of navigation bar in swift 5 programming language. In this tutorial you will get the very sort trick for this problem. Follow the complete tutorial. Because in this tutorial you will get the trick which is used by best iOS developer in the world.

UINavigationBar

Below is the small video related to UINavigationBar Item customisation. Please watch the entire video and share your feedback.

Great πŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ‘‡πŸ» After that, Here I am sharing the important code related to this video.

//MARK: IMPRTANT CODE

    func configureNavigation()  {
        self.navigationItem.title = "My View Controller"
        self.navigationController?.navigationBar.barTintColor = .systemGreen
        self.navigationController?.navigationBar.backgroundColor = .systemGreen
        let attributes = [NSAttributedString.Key.foregroundColor:UIColor.white, NSAttributedString.Key.font:UIFont(name: "Verdana-bold", size: 17)]
        self.navigationController?.navigationBar.titleTextAttributes = attributes as [NSAttributedString.Key : Any]
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "gear"), style: .done, target: self, action: #selector(tapForGear))
    }
    
    @objc func tapForGear() {
        print("Yes OK!!!!")
    }

So Finally you have to with all the messers steps.Β 

In Conclusion, You have done with this tutorial. And hope now the concept of Open new View Controller on button click in iOS with Swift 5. If you have any doubts regarding the Open New View Controller on button click in iOS with Swift 5 then you can comment into the comment box. And if you like this tutorial with a complete description of the simple and attractive tutorial in iOS then pleaseΒ like my videoΒ on YouTube and do not forget to subscribe to myΒ YouTube channel. Because you will get lots of videos related to swift development with very sort tricks.

Besides, If you are more curious about the development and knowing about tutorials then follow the below links πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ˜Ž

Tags
About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd (www.thecolourmoon.com). This website I have made so that I can meet with new challenges and can share here.

Leave a reply

Your email address will not be published. Required fields are marked *