Latest 1.3.1
Homepage https://github.com/Pircate/AYNavigationBar
License MIT
Platforms ios 8.0, requires ARC
Authors

Overview

snapshot

Installation

Use CocoaPods

pod 'AYNavigationBar'

Usage

Import

#import <AYNavigationBar/UIViewController+AYNavigationBar.h>

To enable AYNavigationBar of a navigation controller

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.ay_navigation.configuration.enabled = YES;

Setting

Global

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.ay_navigation.configuration.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor blueColor]};
nav.ay_navigation.configuration.barTintColor = [UIColor cyanColor];
nav.ay_navigation.configuration.backgroundImage = [UIImage imageNamed:@"nav"];
nav.ay_navigation.configuration.shadowImage = [UIImage imageNamed:@"shadow"];
nav.ay_navigation.configuration.translucent = NO;
nav.ay_navigation.configuration.barStyle = UIBarStyleBlack;
nav.ay_navigation.configuration.extraHeight = 14;

Each view controller

normal
self.ay_navigation.bar  -> UINavigationBar
self.ay_navigation.item -> UINavigationItem

// remove blur effect
self.ay_navigation.bar.translucent = NO;

// hide bottom black line
self.ay_navigation.bar.shadowImage = [[UIImage alloc] init];
// if version < iOS 11.0, also need:
[self.ay_navigation.bar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];

// if you need to set status bar style lightContent
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

// if you want change navigation bar position
self.ay_navigation.bar.isUnrestoredWhenViewWillLayoutSubviews = YES;
largeTitle(iOS 11.0+)
// enable
if (@available(iOS 11.0, *)) {
   self.navigationController.navigationBar.prefersLargeTitles = YES; // once
}
// show
if (@available(iOS 11.0, *)) {
   self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAlways;
}
// hide
if (@available(iOS 11.0, *)) {
   self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
}

Latest podspec

{
    "name": "AYNavigationBar",
    "version": "1.3.1",
    "summary": "A custom navigation bar of UIViewController.",
    "description": "A custom navigation bar of UIViewController addtion with CocoaPods support.",
    "homepage": "https://github.com/Pircate/AYNavigationBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Pircate": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Pircate/AYNavigationBar.git",
        "tag": "1.3.1"
    },
    "source_files": "AYNavigationBar/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This