Code Monkey home page Code Monkey logo

large-title-navigation-bar's Introduction

Large-Title-Navigation-Bar

=========

Large Title Navigation Bar in Swift 5.

In this demo show Large Title Navigation Bar.


Added Some screens here.

Usage


Large Title Navigation Bar

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.


//Navigation Configuration
if #available(iOS 11.0, *) {

UINavigationBar.appearance().prefersLargeTitles = true
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().largeTitleTextAttributes =
[NSAttributedString.Key.foregroundColor: UIColor.blue,
NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 30)]

UINavigationBar.appearance().titleTextAttributes =
[NSAttributedString.Key.foregroundColor: UIColor.blue,
NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20)]

} else {
// Fallback on earlier versions
}

return true
}

Large Title Navigation Bar

func multiLineLargeTitleInNavigationBar(viewController: UIViewController, title: String) -> Void {

//Navigation Configuration
if #available(iOS 11.0, *) {

viewController.navigationController?.navigationBar.prefersLargeTitles = true
viewController.navigationController?.navigationItem.largeTitleDisplayMode = .automatic

/*
viewController.navigationController?.navigationBar.largeTitleTextAttributes = [
NSAttributedStringKey.foregroundColor: UIColor.white,
NSAttributedStringKey.font : UIFont.preferredFont(forTextStyle: .largeTitle)
]*/

}else {

}

//Update Large Label
var count = 0
for navItem in(viewController.navigationController?.navigationBar.subviews)! {
for itemSubView in navItem.subviews {
if let largeLabel = itemSubView as? UILabel {
if count == 1 {
break;
}
largeLabel.text = title
largeLabel.numberOfLines = 0
largeLabel.lineBreakMode = .byWordWrapping
count = count + 1
}
}
}

//Update Navigation Title
viewController.navigationController?.navigationBar.layoutSubviews()
viewController.navigationController?.navigationBar.layoutIfNeeded()
}

Large Title Navigation Bar

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
tableView.dataSource = self

self.title = "Hi this is big title, For navigation large style bar"

let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.multiLineLargeTitleInNavigationBar(viewController: self, title: self.title!)
}

License

This code is distributed under the terms and conditions of the MIT license.

Change-log

A brief summary of each this release can be found in the CHANGELOG.

large-title-navigation-bar's People

Contributors

pawankv89 avatar

Stargazers

MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.