Skip to content
UINavigationBar Category which allows you to change its appearance dynamically
Objective-C Ruby
Branch: master
Clone or download
Latest commit 2dbb42e Jul 19, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LTNavigationBar.xcodeproj 修复 NavigationBar title 在 iOS 10 系统下不显示的 BUG Aug 18, 2016
LTNavigationBar fix back indicator view Dec 26, 2016
LTNavigationBarTests init Feb 15, 2015
images support to change content alpha Mar 8, 2015
.gitignore init Feb 15, 2015
LICENSE add pod spec Feb 15, 2015
LTNavigationBar.podspec bump version Dec 26, 2016
README.md Update README.md Jul 20, 2017

README.md

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:

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:

#import "UINavigationBar+Awesome.h"

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

@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:

[self.navigationController.navigationBar lt_setBackgroundColor:[UIColor blueColor]];

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

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar lt_reset];
}

See the example for details~

You can’t perform that action at this time.