Need help with LTNavigationBar?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

ltebean
4.5K Stars 712 Forks MIT License 52 Commits 38 Opened issues

Description

UINavigationBar Category which allows you to change its appearance dynamically

Services available

!
?

Need anything else?

Contributors list

# 19,846
Objecti...
Shell
Swift
37 commits
# 122,249
Objecti...
Ruby
iOS
eventbu...
2 commits
# 168,775
Ruby
Objecti...
1 commit
# 168,137
Objecti...
Swift
photobr...
slidesh...
1 commit
# 5,838
Objecti...
checkbo...
cocoapo...
carthag...
1 commit
# 137,898
Objecti...
Swift
Shell
iOS
1 commit

LTNavigationbar

Deprecated

This lib uses a hacky way to achieve the result, in the new iOS version, the structure of UINavigation is changed and this lib no longer works anymore, so please check these alternatives:

  • https://github.com/andreamazz/AMScrollingNavbar
  • https://github.com/DanisFabric/RainbowNavigation
  • https://github.com/MoZhouqi/KMNavigationBarTransition

swift version

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

First, import this lib: ```objective-c

import "UINavigationBar+Awesome.h"

The category includes lots of method that helps to change UINavigationBar's appearance dynamically:
```objective-c
@interface UINavigationBar (Awesome)
- (void)lt_setBackgroundColor:(UIColor *)backgroundColor;
- (void)lt_setElementsAlpha:(CGFloat)alpha;
- (void)lt_setTranslationY:(CGFloat)translationY;
- (void)lt_reset;
@end

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

objective-c
[self.navigationController.navigationBar lt_setBackgroundColor:[UIColor blueColor]];

And usually in

viewWillDisappear
, you should call this method to avoid any side effects:
objective-c
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar lt_reset];
}

See the example for details~

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.