Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ltebean/LTNavigationBar
UINavigationBar Category which allows you to change its appearance dynamically
https://github.com/ltebean/LTNavigationBar
Last synced: 3 months ago
JSON representation
UINavigationBar Category which allows you to change its appearance dynamically
- Host: GitHub
- URL: https://github.com/ltebean/LTNavigationBar
- Owner: ltebean
- License: mit
- Created: 2015-02-15T11:01:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-26T10:37:42.000Z (about 6 years ago)
- Last Synced: 2024-04-14T13:28:10.528Z (7 months ago)
- Language: Objective-C
- Homepage:
- Size: 4.53 MB
- Stars: 4,467
- Watchers: 112
- Forks: 679
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - LTNavigationBar - UINavigationBar Category which allows you to change its appearance dynamically (UI / Navigation Bar)
- awesome-ios-star - LTNavigationBar - UINavigationBar Category which allows you to change its appearance dynamically (UI / Navigation Bar)
README
![LTNavigationbar](https://cocoapod-badges.herokuapp.com/v/LTNavigationBar/badge.png)
## 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](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](https://raw.githubusercontent.com/ltebean/LTNavigationBar/master/images/demo.gif)#### 2. Making navigation bar scroll along with a scroll view:
![LTNavigationbar](https://raw.githubusercontent.com/ltebean/LTNavigationBar/master/images/demo2.gif)## 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~