Skip to content

ltebean/LTNavigationBar

 
 

Repository files navigation

LTNavigationbar

swift version --> branch swift3.0

https://github.com/ltebean/LTNavigationBar/tree/swift3.0

Purpose

It is hard to change the appearance of UINavigationBar dynamically, so I made this lib to make the job easy.

Demo

1. Changing the background color:

LTNavigationbar

2. Making navigation bar scroll along with a scroll view:

LTNavigationbar

Usage

  • drag UINavigationBarExtension.swift file to project

The Extension includes lots of method that helps to change UINavigationBar's appearance dynamically:

func lt_setBackgroundColor(backgroundColor: UIColor)
func lt_setElementsAlpha(alpha: CGFloat)
func lt_setTranslationY(translationY: CGFloat)
func lt_reset()

You can call the various setter wherever you want, like:

navigationController.navigationBar.lt_setBackgroundColor(.blueColor)

And usually in viewWillDisappear, you should call this method to avoid any side effects:

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    navigationController.navigationBar.lt_reset()
}

About

UINavigationBar Category which allows you to change its appearance dynamically

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6