Latest 0.9.0
Homepage https://github.com/RyanLeeLY/DoubleNavigationController
License MIT
Platforms ios 8.0
Authors

Platform
Version
License MIT
Gmail

Introduction

中文文档

As we all known, UINavigationController is a container view controller that manages one or more child view controllers in a navigation interface. Sometimes, we just wanna update the appearance in current view controller instead of affecting the whole app. DoubleNavigationController is a library that can solve the problem above.

Architecture

We can think of UINavigationController as a tree, and each node is a ViewController that managed by it. By using DoubleNavigationController, we can update the appearance of NavigationBar in current node without affecting its parent node’s. However, its child nodes’ NavigationBar will be affected. The relationship can be described as the picture below.

Example

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Example

Usage

You can customize your navigation by implementing dbn_configNavigationController: in your ViewVontroller.

- (void)dbn_configNavigationController:(UINavigationController *)navigationController {
    [navigationController setNavigationBarHidden:NO animated:NO];
    navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    navigationController.navigationBar.tintColor = [UIColor purpleColor];
    navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:20], NSForegroundColorAttributeName: [UIColor redColor]};
}

- (void)dbn_configNavigationItem:(UINavigationItem *)navigationItem {
    UIBarButtonItem *btnItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(eventFromButton:)];
    navigationItem.rightBarButtonItem = btnItem;
    navigationItem.title = @"Hello";
}

You can also update the appearance of your app’s navigation at any time by using dbn_performBatchUpdates: in the category of UIViewController.

[self dbn_performBatchUpdates:^(UINavigationController * _Nullable navigationController) {
    if (navigationController) {
        navigationController.navigationBar.tintColor = [UIColor purpleColor];
    }
}];

Installation

DoubleNavigationController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'DoubleNavigationController'
end

License

DoubleNavigationController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DoubleNavigationController",
    "version": "0.9.0",
    "summary": "Updating UINavigationController appearance more easily.",
    "description": "Updating UINavigationController's appearance more easily.",
    "homepage": "https://github.com/RyanLeeLY/DoubleNavigationController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "yao.li": "[email protected]"
    },
    "source": {
        "git": "https://github.com/RyanLeeLY/DoubleNavigationController.git",
        "tag": "0.9.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DoubleNavigationController/Classes/**/*"
}

Pin It on Pinterest

Share This