LHNavigationController可以使得您的App支持像网易新闻那样的全屏的push/pop。
0.1.2版本支持
pod LHNavigationController
如果在Swift项目中应用(参见图 SwiftDemo 项目)
use_frameworks!
pod LHNavigationController
然后,在使用Swift文件中
import LHNavigationController
默认效果
3d效果
主要有四个类
如果您想实现网易那样的NavigationBar切换效果,您需要让某些类继承以下
要支持全屏的Pop手势,很简单,只需将您的UINavigationController替换为LHNavigationController即可
要实现全屏的Push,您需要设置LHNavigationController的代理lhDelegate
@property (weak,nonatomic) id<LHNavigationControllerDelegate> lhDelegate;
然后在相应的方法中返回将要push的controller
- (UIViewController *)viewControllerAfterController:(UIViewController *)controller{
//这里的controller是导航堆栈最上面的那个
}
需要继承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文件以获取更多信息。