LHNavigationController 0.1.2

LHNavigationController 0.1.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年7月

LeoMobileDeveloper维护。



  • Leo

LHNavigationController可以使得您的App支持像网易新闻那样的全屏的push/pop。

0.1.2版本支持

  • 全屏push手势
  • 全屏pop手势
  • 切换时导航栏背景色平滑切换
  • 类似于网易或斗鱼的导航栏切换效果

安装

pod LHNavigationController

如果在Swift项目中应用(参见图 SwiftDemo 项目)

use_frameworks!
pod LHNavigationController

然后,在使用Swift文件中

import LHNavigationController

效果

默认效果

3d效果

主要有四个类

  • LHNavigationController(如果您只需全屏push/pop,导航栏背景色平滑切换,则只需这一类,默认导航栏隐藏)

如果您想实现网易那样的NavigationBar切换效果,您需要让某些类继承以下

  • LHViewController
  • LHTableViewController
  • LHCollectionViewController

Pop

要支持全屏的Pop手势,很简单,只需将您的UINavigationController替换为LHNavigationController即可

Push

要实现全屏的Push,您需要设置LHNavigationController的代理lhDelegate

 @property (weak,nonatomic) id<LHNavigationControllerDelegate> lhDelegate;

然后在相应的方法中返回将要push的controller

- (UIViewController *)viewControllerAfterController:(UIViewController *)controller{
   //这里的controller是导航堆栈最上面的那个
}

获得网易or斗鱼类似的导航栏切换效果

需要继承LHViewController来让ViewController自带导航栏

属性

LHViewController

// 访问导航栏 
@property (strong,nonatomic,readonly)UINavigationBar * lh_navigationBar;

// 访问navigationItem
@property (strong,nonatomic,readonly)UINavigationItem * lh_navigationItem;

// 用这个作为ContainView来增加删除subview
@property (strong,nonatomic,readonly)UIView * lh_view;

// 访问LHNativationController
@property (strong,nonatomic,readonly)LHNavigationController * lh_navigationController;

// 设置NavigationBar背景色
@property (strong,nonatomic)UIColor * barTintColor;

// 设置BarButton颜色
@property (strong,nonatomic)UIColor * barItemsTintColor;
// 设置BarTitle颜色
@property (strong,nonatomic)UIColor * barTitlesTintColor

LHNavigationController

//设置转换风格,支持默认和3D两种
@property (assign,nonatomic) LHNavigationTransitionStyle lh_transtionStyle;

原理

我在这篇博客中详细讲解了该库的实现原理。

作者

Leo, leomobiledeveloper

许可协议

LHNavigationController使用的许可协议为MIT。请查看LICENSE文件以获取更多信息。