AYNavigationBar
Overview
Installation
Use CocoaPods
pod 'AYNavigationBar'
Usage
Import
#import "AYNavigationBar.h"
To enable AYNavigationBar of a navigation controller
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.ay_navigation.configuration.enabled = YES;
Setting
global setting
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.extraHeight = 14;
each setting
normal
self.ay_navigation.bar -> UINavigationBar
self.ay_navigation.item -> UINavigationItem
additional
// override alpha & backgroundColor
self.ay_navigation.bar.alpha -> UINavigationBar.barBackgroundView.alpha
self.ay_navigation.bar.backgroundColor -> UINavigationBar.barTintColor
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;
}
网友评论