The iOS framework that grows only as fast as its documentation
NINavigationAppearance Class Reference

Overview

The NINavigationAppearance provides support for saving and restoring the navigation appearance state.

This class is now deprecated due to the ease with which it may cause more problems than it solves. It is recommended that instead of obfuscating navigation appearance by using this class that you define and follow a standard practice of modifying navigation appearance throughout your app that is more explicit.

Use this when you are about to mutate the navigation bar style and/or status bar style, and you want to be able to restore these bar styles sometime in the future.

An example of usage for this pattern is in NIToolbarPhotoViewController which changes the navigation bar style to UIBarStyleBlack and the status bar style to UIStatusBarStyleBlack* in viewWillAppear:.

[NINavigationAppearance pushAppearanceForNavigationController:self.navigationController]
UINavigationBar* navBar = self.navigationController.navigationBar;
navBar.barStyle = UIBarStyleBlack;
navBar.translucent = YES;

Note that the call to NINavigationAppearance must occur before mutating any bar states so that it is able to capture the original state correctly.

Then when NIToolbarPhotoViewController is ready to restore the original navigation appearance state, (in viewWillDisappear:), it calls the following:

[NINavigationAppearance popAppearanceForNavigationController:self.navigationController]

which pops the last snapshot of the stack and applies it, restoring the original navigation appearance state.

Tasks

(void) + pushAppearanceForNavigationController:
 
(void) + popAppearanceForNavigationController:animated:
 
(NSInteger) + count
 
(void) + clear
 

Method Documentation

pushAppearanceForNavigationController:

Take a snapshot of the current navigation appearance.

+ (void)pushAppearanceForNavigationController:(UINavigationController *)navigationController;
Discussion

Call this method before mutating the nav bar style or status bar style.

popAppearanceForNavigationController:animated:

Restore the last navigation appearance snapshot.

+ (void)popAppearanceForNavigationController:(UINavigationController *)navigationController animated:(BOOL)animated;
Discussion

Pops the last appearance values off the stack and applies them.

count

Returns the number of items in the appearance stack.

+ (NSInteger)count;

clear

Remove all navigation appearance snapshots from the stack.

+ (void)clear;