分类为UINavigationController集成了许多方便的功能点

cp6p 9年前

"UINavigationController+JZExtension"分类为UINavigationController集成了许多方便的功能点,同时为它打开了一些隐藏功能。

Features

Overview

overview

Why JZNavigationExtension?

  • Pop Gesture Works Perfect With UITableView【全屏Pop手势完美匹配UITableView无冲突】
  • Enable or disable property for each view controller conveniently.【简单地针对每一个Controller开关属性】
  • Pushes/Pops a view controller when hides/shows navigation bar display soomthly【当控制器做Push/Pop时无缝、平滑地显隐导航栏】
  • Release some restrictions make your navigation controller stronger【解除一些限制,使你的导航控制器更加强大】
  • Follow Apple's API design principles,uses as natural as system api【遵循Apple Inc的API设计原则,使用就像系统API一样自然】

Usage

To gives you a fullscreen interactivePopGestureRecognizer【打开全屏Pop手势】:

navigationController.fullScreenInteractivePopGestureRecognizer = YES;

To hides navigation bar when the view controller is pushed on to a navigation controller【支持转场隐藏、显示导航栏】:

UIViewController *viewController = [UIViewController new];  viewController.hidesNavigationBarWhenPushed = YES;  [self.navigationController pushToViewController:viewController animated:YES];

To Push/Pop view controller With blocks【导航控制器转场回调】:

[self.navigationController pushViewController:viewController animated:YES completion:^(BOOL finished) { ///Do any thing }];

To adjust navigation/tool bar background alpha【调节导航控制器的导航栏、工具条透明度】:

navigationController.navigationBarBackgroundAlpha = yourAlpha;

To change navigation/tool bar size【改变导航控制器的导航栏、工具条大小】:

[navigationController setNavigationBarSize:size];

or you can also change their frame.size manually 【你也可以手动改变它们的frame】

CGRect rect = self.navigationBar.frame;  rect.size = navigationBarSize;  self.navigationBar.frame = rect;

To hide navigation bar background alpha during pop gesture is interactiving

UIViewController *viewController = [UIViewController new];  viewController.navigationBarBackgroundHidden = YES;

overview


Installation

Use cocoapods

pod 'JZNavigationExtension'

Manually

Drag all source files under floder JZNavigationExtension to your project.

UINavigationController+JZExtension.h    UINavigationController+JZExtension.m

项目主页:http://www.open-open.com/lib/view/home/1436104343221