Skip to content

interactiveservices/NavigationBarAppearance

Repository files navigation

NavigationBarAppearance

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Stop seraching stackoverflow and just do it in a few lines of code with declarative manner

Features

configure NavigationBar:

let navigationBar = UINavigationBar.appearance()
- image (globaly and in currentVC)
navigationBar.apply(attribute:.backgroundImage(UIImage(named:"NavigationBar")))

- solidColor (globaly and in currentVC)
navigationBar.apply(attribute:.plainColor(.blue)))

- titleAttributes (globaly and in currentVC)
navigationBar.apply(attributes:[
    NavigationBarAttribute.titleColor(.red),
    NavigationBarAttribute.titleFont(.boldSystemFont(ofSize: 20))
])
  • remove or set back shadow in on line of code
self.naviagtionController?.navigationBar.apply(attribute:.showShadow(false))
  • customise backbutton image and title for NavigationController subclass named IASNavigationController subclass IASNavigationController or create it in code. Then before show it set it navigationBarAttributes property to anything you want
IASNavigationController(rootViewController: UIViewController(), 
                        attributes: [.backButton("GoBack",UIImage(named:"BackButton"))])

Configure UIBarButtonItem:

  • barbuttonsTitleAttributes (globaly and in currentVC) and ect
let barButtonItem = UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self])
barButtonItem.apply(attributes: [.barButtonTitleFont(.systemFont(ofSize: 10)),
                                 .barButtonTitleColor(.gree])

Requirements

  • iOS 7

Installation

NavigationBarAppearance is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "NavigationBarAppearance"

Author

nikolay.shubenkov@gmail.com, n.shubenkov@be-interactive.ru

License

NavigationBarAppearance is available under the MIT license. See the LICENSE file for more info.

About

Easy way to customize navigationbar and barbuttonitem appearance of your viewcontroller or entire applcation in declarative manner

Resources

License

Stars

Watchers

Forks

Packages

No packages published