├── images ├── show.gif ├── show2.gif └── show3.gif ├── LSNavigationController ├── LSNavigationController │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── navBar_back_icon.imageset │ │ │ ├── back_icon@2x.png │ │ │ ├── back_icon@3x.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── LSNavigationController │ │ ├── UIScrollView+LSCategory.h │ │ ├── UIViewController+LSNavigationController.h │ │ ├── LSNavigationController.h │ │ ├── UINavigationBar+LSNavigationController.h │ │ ├── UIScrollView+LSCategory.m │ │ ├── LSNavigationController.m │ │ ├── UINavigationBar+LSNavigationController.m │ │ └── UIViewController+LSNavigationController.m │ ├── FourViewController.h │ ├── TwoViewController.h │ ├── OneViewController.h │ ├── ThreeViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── LSNavigationController基类实现 │ │ ├── LSNavigationController.h │ │ ├── UIView+LSNavigationController.h │ │ ├── LSNavigationBar.h │ │ ├── UINavigationBar+LSNavigationController.h │ │ ├── LSViewController.h │ │ ├── LSNavigationBar.m │ │ ├── UIView+LSNavigationController.m │ │ ├── LSNavigationController.m │ │ ├── UINavigationBar+LSNavigationController.m │ │ └── LSViewController.m │ ├── FourViewController.m │ ├── Info.plist │ ├── ThreeViewController.xib │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── OneViewController.m │ ├── AppDelegate.m │ ├── ThreeViewController.m │ ├── TwoViewController.m │ └── FourViewController.xib ├── LSNavigationController.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── LSNavigationControllerTests │ ├── Info.plist │ └── LSNavigationControllerTests.m └── LSNavigationControllerUITests │ ├── Info.plist │ └── LSNavigationControllerUITests.m ├── LICENSE ├── README.md └── .gitignore /images/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsmakethebest/LSNavigationController/HEAD/images/show.gif -------------------------------------------------------------------------------- /images/show2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsmakethebest/LSNavigationController/HEAD/images/show2.gif -------------------------------------------------------------------------------- /images/show3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsmakethebest/LSNavigationController/HEAD/images/show3.gif -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UIScrollView+LSCategory.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface UIScrollView (LSCategory) 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Assets.xcassets/navBar_back_icon.imageset/back_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsmakethebest/LSNavigationController/HEAD/LSNavigationController/LSNavigationController/Assets.xcassets/navBar_back_icon.imageset/back_icon@2x.png -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Assets.xcassets/navBar_back_icon.imageset/back_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsmakethebest/LSNavigationController/HEAD/LSNavigationController/LSNavigationController/Assets.xcassets/navBar_back_icon.imageset/back_icon@3x.png -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/FourViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FourViewController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/8/1. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FourViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/TwoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwoViewController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/27. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LSNavigationController.h" 11 | @interface TwoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/OneViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OneViewController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/29. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LSNavigationController.h" 11 | 12 | @interface OneViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/ThreeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/28. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LSNavigationController.h" 11 | @interface ThreeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LSNavigationController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LSNavigationController : UINavigationController 12 | 13 | @property (nonatomic,assign) BOOL cancelGesture; 14 | 15 | @end 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/UIView+LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+EnlargeTouchArea.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/29. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UINavigationBar+LSNavigationController.h" 11 | @interface UIView (LSNavigationController) 12 | 13 | @property (nonatomic,assign) BOOL ls_nav_enlargeTop; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // LSNavigationBar.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/27. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LSTopNavigationBar : UINavigationBar 12 | @end 13 | 14 | 15 | @interface LSNavigationBar : UINavigationBar 16 | 17 | 18 | @end 19 | 20 | @interface LSNavigationItem : UINavigationItem 21 | 22 | @end 23 | 24 | 25 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Assets.xcassets/navBar_back_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "back_icon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "back_icon@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/UINavigationBar+LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+LSNavigationController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/28. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationBar (LSNavigationController) 12 | 13 | + (void)ls_navBar_exchangeInstanceMethod : (Class) dClass originalSel :(SEL)originalSelector newSel: (SEL)newSelector; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UIViewController+LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+LSNavigationController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/30. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | @class LSNavigationBar; 11 | 12 | 13 | 14 | @interface UIViewController (LSNavigationController) 15 | 16 | @property (nonatomic,weak) LSNavigationBar *navigationBar; 17 | 18 | @property (nonatomic,assign) BOOL cancelGesture; //取消当前页面手势 不影响其他VC手势使用 19 | 20 | 21 | 22 | //创建UINavigationBar 23 | -(void)reloadNavigationBar; 24 | 25 | //删除UINavigationBar 26 | -(void)removeNavigationBar; 27 | 28 | //根据UIColor生成UIImage 29 | - (UIImage*)ls_imageWithColor:(UIColor*)color; 30 | 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LSNavigationController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIViewController+LSNavigationController.h" 11 | #import "UINavigationBar+LSNavigationController.h" 12 | 13 | 14 | @interface LSNavigationController : UINavigationController 15 | 16 | @property (nonatomic,assign) BOOL cancelGesture;//禁用整个导航控制器手势 如果想在启用必须在设置为NO 17 | 18 | @end 19 | 20 | 21 | @interface LSTopNavigationBar : UINavigationBar 22 | @end 23 | 24 | @interface LSNavigationBar : UINavigationBar 25 | @end 26 | 27 | @interface LSNavigationItem : UINavigationItem 28 | @end 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationControllerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationControllerUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LSViewController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/27. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LSNavigationBar.h" 11 | #import "LSNavigationController.h" 12 | @interface LSViewController : UIViewController 13 | 14 | @property (nonatomic,weak) LSNavigationBar *navigationBar; 15 | 16 | 17 | @property (nonatomic,assign) BOOL cancelGesture; //取消当前页面手势 不影响其他VC手势使用 18 | @property (nonatomic,assign) BOOL cancelAllGesture;//取消整个导航控制器手势 如果想在启用必须在设置为NO 19 | 20 | //重载UINavigationBar 21 | -(void)reloadNavigationBar; 22 | 23 | //删除UINavigationBar 24 | -(void)removeNavigationBar; 25 | 26 | //左上角返回按钮点击事件 如果想hook 重写此方法即可 27 | -(void)navigationBarClickBack; 28 | 29 | //根据UIColor生成UIImage 30 | - (UIImage*)imageWithColor:(UIColor*)color; 31 | 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UINavigationBar+LSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+LSNavigationController.h 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/28. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //UIView的level用于在当前view上添加覆盖整个屏幕的view并且不被navigationBar覆盖 12 | typedef NS_ENUM(NSInteger,UIViewLevel){ 13 | UIViewLevelLow=0, 14 | UIViewLevelMiddle, 15 | UIViewLevelHigh 16 | }; 17 | 18 | @class LSTopNavigationBar; 19 | 20 | @interface UINavigationBar (LSNavigationController) 21 | 22 | + (void)ls_navBar_exchangeInstanceMethod:(Class) dClass originalSel:(SEL)originalSelector newSel:(SEL)newSelector; 23 | 24 | @end 25 | 26 | 27 | @interface UIView (LSNavigationController) 28 | 29 | @property (nonatomic,assign) UIViewLevel viewLevel; 30 | 31 | //是ViewController的根view 32 | @property (nonatomic,assign) BOOL ls_isViewControllerBaseView; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 lsmakethebest 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/FourViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FourViewController.m 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/8/1. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import "FourViewController.h" 10 | 11 | @interface FourViewController () 12 | 13 | @end 14 | 15 | @implementation FourViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view from its nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | - (IBAction)back:(id)sender { 27 | [self.navigationController popToRootViewControllerAnimated:YES]; 28 | } 29 | 30 | /* 31 | #pragma mark - Navigation 32 | 33 | // In a storyboard-based application, you will often want to do a little preparation before navigation 34 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 35 | // Get the new view controller using [segue destinationViewController]. 36 | // Pass the selected object to the new view controller. 37 | } 38 | */ 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationControllerTests/LSNavigationControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LSNavigationControllerTests.m 3 | // LSNavigationControllerTests 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LSNavigationControllerTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LSNavigationControllerTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LSNavigationController 2 | 3 | ### 将文件拖到项目里,想要这种效果的导航控制器继承LSNavigationController 4 | ### 每个VC都有一个UINavigationBar,导航控制器的navigationBar被隐藏 5 | 6 | ### 使用此框架适用于frame从0开始算的项目 7 | ### 设置UINavigationBar,UIBarButtonItem 和系统使用方法一样 8 | ![image](https://github.com/lsmakethebest/LSNavigationController/blob/master/images/show.gif) 9 | 10 | ### 在UIViewController里设置 ,如果有基类直接在基类设置一遍就不用在设置了 11 | ` 12 | - (void)viewDidLoad{ 13 | 14 | [super viewDidLoad]; 15 | [self reloadNavigationBar];//创建UINavigationBar 必须在设设置item前面 也可以在基类统一创建 16 | self.title=@"第一页"; 17 | UIBarButtonItem *item=[[UIBarButtonItem alloc]initWithTitle:@"push" style:(UIBarButtonItemStylePlain) target:self action:@selector(click)]; 18 | self.navigationItem.rightBarButtonItem=item; 19 | [self.navigationBar setBackgroundImage:[self imageWithColor:[UIColor orangeColor]] forBarMetrics:UIBarMetricsDefault]; 20 | } 21 | 22 | ` 23 | 24 | ### 禁用启用侧滑手势 在viewDidLoad里设置即可 25 | ` 26 | @property (nonatomic,assign) BOOL cancelGesture; //取消当前页面手势 不影响其他VC手势使用 27 | ` 28 | ### 禁用启用所有界面侧滑手势 29 | `self.navigationController.cancelGesture=YES;//禁用整个导航控制器手势 如果想在启用必须在设置为NO 30 | ` 31 | ### 如果想在当前view上添加一个全屏view覆盖navigationBar 32 | `` 33 | //设置要添加view的view.viewLevel即可 34 | view.viewLevel=UIViewLevelHigh; 35 | //然后再addSubview 36 | `` 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSNavigationBar.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // LSNavigationBar.m 5 | // LSNavigationController 6 | // 7 | // Created by liusong on 2018/3/27. 8 | // Copyright © 2018年 liusong. All rights reserved. 9 | // 10 | 11 | #import "LSNavigationBar.h" 12 | #import 13 | 14 | @implementation LSTopNavigationBar 15 | @end 16 | 17 | 18 | 19 | 20 | @implementation LSNavigationBar 21 | 22 | -(void)layoutSubviews{ 23 | [super layoutSubviews]; 24 | for (UIView *view in self.subviews) { 25 | NSString *className=NSStringFromClass([view class]); 26 | if ([className isEqualToString:@"_UIBarBackground"]) { 27 | 28 | CGFloat height=[UIApplication sharedApplication].statusBarFrame.size.height; 29 | CGRect frame=self.bounds; 30 | frame.size.height =self.frame.size.height+height; 31 | frame.origin.y=-height; 32 | view.frame=frame; 33 | 34 | } 35 | } 36 | } 37 | 38 | @end 39 | 40 | 41 | 42 | @implementation LSNavigationItem 43 | 44 | -(void)setLeftBarButtonItem:(UIBarButtonItem *)leftBarButtonItem 45 | { 46 | //解决ios11以下系统 设置leftBarButtonItem不显示问题 通过延迟也可以解决 但是此方法不用延时也可以解决 47 | dispatch_async(dispatch_get_main_queue(), ^{ 48 | [super setLeftBarButtonItem:leftBarButtonItem]; 49 | }); 50 | } 51 | 52 | @end 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UIScrollView+LSCategory.m: -------------------------------------------------------------------------------- 1 | 2 | #import "UIScrollView+LSCategory.h" 3 | 4 | @implementation UIScrollView (LSCategory) 5 | 6 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 7 | if ([self panBack:gestureRecognizer]) { 8 | return NO; 9 | } 10 | return YES; 11 | } 12 | 13 | 14 | -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 15 | { 16 | if ([self panBack:gestureRecognizer]) { 17 | return YES; 18 | } 19 | 20 | return NO; 21 | } 22 | 23 | - (BOOL)panBack:(UIGestureRecognizer *)gestureRecognizer { 24 | if (gestureRecognizer == self.panGestureRecognizer) { 25 | CGPoint point = [self.panGestureRecognizer translationInView:self]; 26 | UIGestureRecognizerState state = gestureRecognizer.state; 27 | 28 | // 设置手势滑动的位置距屏幕左边的区域 29 | CGFloat locationDistance = [UIScreen mainScreen].bounds.size.width; 30 | 31 | if (state == UIGestureRecognizerStateBegan || state == UIGestureRecognizerStatePossible) { 32 | CGPoint location = [gestureRecognizer locationInView:self]; 33 | if (point.x > 0 && location.x < locationDistance && self.contentOffset.x <= 0) { 34 | return YES; 35 | } 36 | } 37 | } 38 | return NO; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationControllerUITests/LSNavigationControllerUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LSNavigationControllerUITests.m 3 | // LSNavigationControllerUITests 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LSNavigationControllerUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LSNavigationControllerUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/ThreeViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/UIView+LSNavigationController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | // 9 | // UIView+EnlargeTouchArea.m 10 | // LSNavigationController 11 | // 12 | // Created by liusong on 2018/3/29. 13 | // Copyright © 2018年 liusong. All rights reserved. 14 | // 15 | 16 | #import "UIView+LSNavigationController.h" 17 | #import 18 | #import "LSNavigationBar.h" 19 | 20 | @implementation UIView (LSNavigationController) 21 | 22 | +(void)load 23 | { 24 | [UINavigationBar ls_navBar_exchangeInstanceMethod:[self class] originalSel:@selector(hitTest:withEvent:) newSel:@selector(ls_hitTest:withEvent:)]; 25 | 26 | } 27 | 28 | -(BOOL)ls_nav_enlargeTop 29 | { 30 | return [objc_getAssociatedObject(self, _cmd) boolValue]; 31 | } 32 | 33 | -(void)setLs_nav_enlargeTop:(BOOL)ls_nav_enlargeTop 34 | { 35 | objc_setAssociatedObject(self, @selector(ls_nav_enlargeTop), @(ls_nav_enlargeTop), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 36 | } 37 | 38 | - (UIView*) ls_hitTest:(CGPoint) point withEvent:(UIEvent*) event 39 | { 40 | UIView *view=[self ls_hitTest:point withEvent:event]; 41 | if (view) { 42 | return view; 43 | }else{ 44 | if (self.ls_nav_enlargeTop==NO) 45 | { 46 | return view; 47 | }else{ 48 | for (UIView *subview in self.subviews) { 49 | if ([subview isKindOfClass:[LSNavigationBar class]]) { 50 | CGPoint newPoint=[subview convertPoint:point fromView:self]; 51 | return [subview hitTest:newPoint withEvent:event]; 52 | } 53 | } 54 | return nil; 55 | } 56 | } 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSNavigationController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // LSNavigationController.m 4 | // LSNavigationController 5 | // 6 | // Created by liusong on 2018/3/22. 7 | // Copyright © 2018年 liusong. All rights reserved. 8 | // 9 | 10 | #import "LSNavigationController.h" 11 | #import 12 | #import "LSNavigationBar.h" 13 | #import "LSViewController.h" 14 | #import 15 | @interface LSNavigationController () 16 | 17 | @property (nonatomic,strong) UIPanGestureRecognizer *panRecognizer; 18 | 19 | @end 20 | 21 | 22 | @implementation LSNavigationController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | 27 | self.navigationBar.hidden=YES; 28 | LSTopNavigationBar *navbar=[[LSTopNavigationBar alloc]init] ; 29 | navbar.hidden=NO; 30 | [self setValue:navbar forKeyPath:@"_navigationBar"]; 31 | 32 | self.interactivePopGestureRecognizer.delegate=self; 33 | 34 | } 35 | -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 36 | { 37 | 38 | if ([viewController isKindOfClass:[LSViewController class]]) { 39 | LSViewController *vc=(LSViewController*)viewController; 40 | [vc setValue:self forKeyPath:@"ls_navigationController"]; 41 | } 42 | if (self.viewControllers.count>=1) { 43 | viewController.hidesBottomBarWhenPushed=YES; 44 | } 45 | [super pushViewController:viewController animated:animated]; 46 | } 47 | -(void)setCancelGesture:(BOOL)cancelGesture 48 | { 49 | _cancelGesture=cancelGesture; 50 | self.interactivePopGestureRecognizer.enabled=!cancelGesture; 51 | } 52 | @end 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/OneViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // OneViewController.m 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/29. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import "OneViewController.h" 10 | #import "TwoViewController.h" 11 | @interface OneViewController () 12 | @property (weak, nonatomic) UILabel *label; 13 | @property (nonatomic,assign) int i ; 14 | @end 15 | 16 | @implementation OneViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | [self reloadNavigationBar]; 22 | 23 | [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(handleTime) userInfo:nil repeats:YES]; 24 | 25 | [self.navigationBar setBackgroundImage:[self ls_imageWithColor:[UIColor orangeColor]] forBarMetrics:UIBarMetricsDefault]; 26 | 27 | UIBarButtonItem *item=[[UIBarButtonItem alloc]initWithTitle:@"push" style:(UIBarButtonItemStylePlain) target:self action:@selector(click)]; 28 | self.navigationItem.rightBarButtonItem=item; 29 | self.title=@"第一页"; 30 | 31 | UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(100, 200, 100, 100)]; 32 | [self.view addSubview:label]; 33 | label.font=[UIFont systemFontOfSize:14]; 34 | 35 | self.label=label; 36 | 37 | 38 | UIButton *close=[[UIButton alloc]init]; 39 | close.frame=CGRectMake(100, 100, 140, 50); 40 | [close setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 41 | [close setTitle:@"禁止手势打开" forState:UIControlStateNormal]; 42 | [close setTitle:@"禁止手势关闭" forState:UIControlStateSelected]; 43 | [close addTarget:self action:@selector(closeAll:) forControlEvents:UIControlEventTouchUpInside]; 44 | [self.view addSubview:close]; 45 | } 46 | -(void)closeAll:(UIButton*)btn 47 | { 48 | self.navigationController.cancelGesture=!self.navigationController.cancelGesture; 49 | btn.selected=self.navigationController.cancelGesture; 50 | } 51 | 52 | 53 | -(void)click 54 | { 55 | [self.navigationController pushViewController:[[TwoViewController alloc]init] animated:YES]; 56 | } 57 | 58 | -(void)handleTime 59 | { 60 | self.label.text=[NSString stringWithFormat:@"文字:%d",self.i]; 61 | self.i++; 62 | } 63 | 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/UINavigationBar+LSNavigationController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // UINavigationBar+LSNavigationController.m 5 | // LSNavigationController 6 | // 7 | // Created by liusong on 2018/3/28. 8 | // Copyright © 2018年 liusong. All rights reserved. 9 | // 10 | 11 | #import "UINavigationBar+LSNavigationController.h" 12 | #import 13 | #import "LSNavigationBar.h" 14 | 15 | @implementation UINavigationBar (LSNavigationController) 16 | 17 | + (void)ls_navBar_exchangeInstanceMethod : (Class) dClass originalSel :(SEL)originalSelector newSel: (SEL)newSelector 18 | { 19 | Method originalMethod = class_getInstanceMethod(dClass, originalSelector); 20 | Method newMethod = class_getInstanceMethod(dClass, newSelector); 21 | //将 newMethod的实现 添加到系统方法中 也就是说 将 originalMethod方法指针添加成 22 | //方法newMethod的 返回值表示是否添加成功 23 | BOOL isAdd = class_addMethod(dClass, originalSelector, 24 | method_getImplementation(newMethod), 25 | method_getTypeEncoding(newMethod)); 26 | //添加成功了 说明 本类中不存在新方法 27 | //所以此时必须将新方法的实现指针换成原方法的,否则 新方法将没有实现。 28 | if (isAdd) { 29 | class_replaceMethod(dClass, newSelector, 30 | method_getImplementation(originalMethod), 31 | method_getTypeEncoding(originalMethod)); 32 | } else { 33 | //添加失败了 说明本类中 有methodB的实现,此时只需要将 34 | // originalMethod和newMethod的IMP互换一下即可。 35 | method_exchangeImplementations(originalMethod, newMethod); 36 | } 37 | 38 | } 39 | +(void)load 40 | { 41 | Class dClass=[self class]; 42 | [self ls_navBar_exchangeInstanceMethod:dClass originalSel:@selector(pushNavigationItem:) newSel:@selector(ls_pushNavigationItem:)]; 43 | [self ls_navBar_exchangeInstanceMethod:dClass originalSel:@selector(pushNavigationItem:animated:) newSel:@selector(ls_pushNavigationItem:animated:)]; 44 | 45 | } 46 | 47 | 48 | -(void)ls_pushNavigationItem:(UINavigationItem *)item 49 | { 50 | if ([self isKindOfClass:[LSTopNavigationBar class]]) { 51 | item=[[UINavigationItem alloc]init]; 52 | item.leftBarButtonItem=[UIBarButtonItem new]; 53 | } 54 | [self ls_pushNavigationItem:item]; 55 | } 56 | 57 | -(void)ls_pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated 58 | { 59 | if ([self isKindOfClass:[LSTopNavigationBar class]]) { 60 | item=[[UINavigationItem alloc]init]; 61 | } 62 | [self ls_pushNavigationItem:item animated:animated]; 63 | } 64 | 65 | 66 | @end 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/LSNavigationController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // LSNavigationController.m 4 | // LSNavigationController 5 | // 6 | // Created by liusong on 2018/3/22. 7 | // Copyright © 2018年 liusong. All rights reserved. 8 | // 9 | 10 | #import "LSNavigationController.h" 11 | #import 12 | 13 | @interface LSNavigationController () 14 | 15 | @property (nonatomic,strong) UIPanGestureRecognizer *panRecognizer; 16 | 17 | @end 18 | 19 | 20 | @implementation LSNavigationController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | self.navigationBar.hidden=YES; 26 | LSTopNavigationBar *navbar=[[LSTopNavigationBar alloc]init] ; 27 | navbar.hidden=NO; 28 | [self setValue:navbar forKeyPath:@"_navigationBar"]; 29 | self.interactivePopGestureRecognizer.delegate=self; 30 | 31 | } 32 | -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 33 | { 34 | [viewController setValue:self forKeyPath:@"ls_navigationController"]; 35 | if (self.viewControllers.count>=1) { 36 | viewController.hidesBottomBarWhenPushed=YES; 37 | } 38 | [super pushViewController:viewController animated:animated]; 39 | } 40 | -(void)setCancelGesture:(BOOL)cancelGesture 41 | { 42 | _cancelGesture=cancelGesture; 43 | self.interactivePopGestureRecognizer.enabled=!cancelGesture; 44 | } 45 | 46 | @end 47 | 48 | 49 | @implementation LSTopNavigationBar 50 | @end 51 | 52 | @implementation LSNavigationBar 53 | 54 | -(void)layoutSubviews{ 55 | [super layoutSubviews]; 56 | for (UIView *view in self.subviews) { 57 | NSString *className=NSStringFromClass([view class]); 58 | if ([className isEqualToString:@"_UIBarBackground"]||[className isEqualToString:@"_UINavigationBarBackground"]) { 59 | 60 | CGFloat height=[UIApplication sharedApplication].statusBarFrame.size.height; 61 | CGRect frame=self.bounds; 62 | frame.size.height =self.frame.size.height+height; 63 | frame.origin.y=-height; 64 | view.frame=frame; 65 | } 66 | } 67 | } 68 | 69 | @end 70 | 71 | 72 | 73 | @implementation LSNavigationItem 74 | 75 | -(void)setLeftBarButtonItem:(UIBarButtonItem *)leftBarButtonItem 76 | { 77 | //解决ios11以下系统 设置leftBarButtonItem不显示问题 通过延迟也可以解决 但是此方法不用延时也可以解决 78 | dispatch_async(dispatch_get_main_queue(), ^{ 79 | [super setLeftBarButtonItem:leftBarButtonItem]; 80 | }); 81 | } 82 | 83 | 84 | @end 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/22. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "LSNavigationController.h" 11 | #import "OneViewController.h" 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | 21 | self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; 22 | self.window.backgroundColor=[UIColor whiteColor]; 23 | 24 | LSNavigationController *nav1=[[LSNavigationController alloc]initWithRootViewController:[[OneViewController alloc]init]]; 25 | nav1.title=@"第一页"; 26 | 27 | LSNavigationController *nav2=[[LSNavigationController alloc]initWithRootViewController:[[OneViewController alloc]init]]; 28 | nav2.title=@"第一页"; 29 | UITabBarController *tab= [[UITabBarController alloc]init]; 30 | tab.viewControllers=@[nav1,nav2]; 31 | self.window.rootViewController=tab; 32 | [self.window makeKeyAndVisible]; 33 | 34 | 35 | return YES; 36 | } 37 | 38 | 39 | - (void)applicationWillResignActive:(UIApplication *)application { 40 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 41 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 42 | } 43 | 44 | 45 | - (void)applicationDidEnterBackground:(UIApplication *)application { 46 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 47 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 48 | } 49 | 50 | 51 | - (void)applicationWillEnterForeground:(UIApplication *)application { 52 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 53 | } 54 | 55 | 56 | - (void)applicationDidBecomeActive:(UIApplication *)application { 57 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 58 | } 59 | 60 | 61 | - (void)applicationWillTerminate:(UIApplication *)application { 62 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 63 | } 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/ThreeViewController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | // 5 | // ThreeViewController.m 6 | // LSNavigationController 7 | // 8 | // Created by liusong on 2018/3/28. 9 | // Copyright © 2018年 liusong. All rights reserved. 10 | // 11 | 12 | #import "ThreeViewController.h" 13 | #import "OneViewController.h" 14 | #import "FourViewController.h" 15 | @interface ThreeViewController () 16 | 17 | @end 18 | 19 | @implementation ThreeViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | [self reloadNavigationBar]; 24 | self.cancelGesture=YES; 25 | 26 | self.view.backgroundColor=[UIColor whiteColor]; 27 | [self.navigationBar setBackgroundImage:[self ls_imageWithColor:[UIColor cyanColor]] forBarMetrics:UIBarMetricsDefault]; 28 | 29 | 30 | 31 | UITableView *view=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 375, 300) style:(UITableViewStyleGrouped)]; 32 | view.dataSource=self; 33 | view.delegate=self; 34 | 35 | view.estimatedSectionHeaderHeight=0; 36 | view.estimatedSectionFooterHeight=0; 37 | view.estimatedRowHeight=0; 38 | UIView *header=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)]; 39 | view.tableHeaderView=header; 40 | 41 | [self.view addSubview:view]; 42 | 43 | 44 | UIButton *btn=[[UIButton alloc]init]; 45 | [btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; 46 | [btn setTitle:@"back" forState:UIControlStateNormal]; 47 | btn.backgroundColor=[UIColor orangeColor]; 48 | btn.frame=CGRectMake(100,407, 50, 50); 49 | [self.view addSubview:btn]; 50 | 51 | 52 | 53 | self.title=@"第三页"; 54 | self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"back" style:(UIBarButtonItemStylePlain) target:self action:@selector(back)]; 55 | 56 | self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"push" style:(UIBarButtonItemStylePlain) target:self action:@selector(push)]; 57 | 58 | } 59 | 60 | -(void)push 61 | { 62 | [self.navigationController pushViewController:[[FourViewController alloc]init] animated:YES]; 63 | } 64 | 65 | 66 | -(void)back 67 | { 68 | [self.navigationController popViewControllerAnimated:YES]; 69 | 70 | } 71 | 72 | 73 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 74 | { 75 | return 10; 76 | } 77 | -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 78 | { 79 | return 10; 80 | } 81 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 82 | { 83 | static NSString *identifier=@"cell"; 84 | UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:identifier]; 85 | if (cell==nil) { 86 | cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier]; 87 | } 88 | cell.textLabel.text=[NSString stringWithFormat:@"%ld",indexPath.row]; 89 | return cell; 90 | } 91 | 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/TwoViewController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // TwoViewController.m 5 | // LSNavigationController 6 | // 7 | // Created by liusong on 2018/3/27. 8 | // Copyright © 2018年 liusong. All rights reserved. 9 | // 10 | 11 | #import "TwoViewController.h" 12 | #import "ThreeViewController.h" 13 | 14 | @interface TwoViewController () 15 | 16 | @end 17 | 18 | @implementation TwoViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | self.view.backgroundColor=[UIColor purpleColor]; 23 | self.edgesForExtendedLayout=UIRectEdgeTop; 24 | [self reloadNavigationBar]; 25 | 26 | self.title=@"第二页"; 27 | UIBarButtonItem *item=[[UIBarButtonItem alloc]initWithTitle:@"push" style:(UIBarButtonItemStylePlain) target:self action:@selector(pushThree)]; 28 | self.navigationItem.rightBarButtonItem=item; 29 | 30 | 31 | 32 | 33 | UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(50, 100, 100, 50)]; 34 | [btn setTitle:@"showView" forState:UIControlStateNormal]; 35 | [btn addTarget:self action:@selector(show) forControlEvents:UIControlEventTouchUpInside]; 36 | btn.backgroundColor=[UIColor blueColor]; 37 | [self.view addSubview:btn]; 38 | 39 | UIButton *btn2=[[UIButton alloc]initWithFrame:CGRectMake(50, 164, 100, 50)]; 40 | [btn2 setTitle:@"pushVC" forState:UIControlStateNormal]; 41 | [btn2 addTarget:self action:@selector(pushVC) forControlEvents:UIControlEventTouchUpInside]; 42 | btn2.backgroundColor=[UIColor blueColor]; 43 | [self.view addSubview:btn2]; 44 | 45 | 46 | UIButton *btn3=[[UIButton alloc]initWithFrame:CGRectMake(50, 234, 100, 50)]; 47 | [btn3 setTitle:@"back" forState:UIControlStateNormal]; 48 | [btn3 addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; 49 | btn3.backgroundColor=[UIColor blueColor]; 50 | [self.view addSubview:btn3]; 51 | 52 | 53 | 54 | } 55 | -(void)back 56 | { 57 | [self.navigationController popViewControllerAnimated:YES]; 58 | } 59 | 60 | -(void)show 61 | { 62 | CGSize size=[UIScreen mainScreen].bounds.size; 63 | UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0,size.width, size.height)]; 64 | view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:0.6]; 65 | view.viewLevel=UIViewLevelHigh; 66 | 67 | UIButton *btn=[[UIButton alloc]init]; 68 | btn.frame=CGRectMake(100, 300, 100, 50); 69 | [btn addTarget:self action:@selector(pushVC) forControlEvents:UIControlEventTouchUpInside]; 70 | [btn setTitle:@"push" forState:UIControlStateNormal]; 71 | [view addSubview:btn]; 72 | 73 | UIButton *btn2=[[UIButton alloc]init]; 74 | btn2.frame=CGRectMake(100, 200, 100, 50); 75 | [btn2 addTarget:self action:@selector(hide:) forControlEvents:UIControlEventTouchUpInside]; 76 | [btn2 setTitle:@"隐藏" forState:UIControlStateNormal]; 77 | [view addSubview:btn2]; 78 | 79 | 80 | [self.view addSubview:view]; 81 | } 82 | 83 | -(void)hide:(UIButton*)btn 84 | { 85 | [btn.superview removeFromSuperview]; 86 | } 87 | -(void)pushVC 88 | { 89 | [self.navigationController pushViewController:[TwoViewController new] animated:YES]; 90 | } 91 | -(void)pushThree 92 | { 93 | [self.navigationController pushViewController:[ThreeViewController new] animated:YES]; 94 | } 95 | @end 96 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/FourViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UINavigationBar+LSNavigationController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // UINavigationBar+LSNavigationController.m 5 | // LSNavigationController 6 | // 7 | // Created by liusong on 2018/3/28. 8 | // Copyright © 2018年 liusong. All rights reserved. 9 | // 10 | 11 | #import "UINavigationBar+LSNavigationController.h" 12 | #import 13 | #import "LSNavigationController.h" 14 | 15 | 16 | @implementation UINavigationBar (LSNavigationController) 17 | 18 | + (void)ls_navBar_exchangeInstanceMethod : (Class) dClass originalSel :(SEL)originalSelector newSel: (SEL)newSelector 19 | { 20 | Method originalMethod = class_getInstanceMethod(dClass, originalSelector); 21 | Method newMethod = class_getInstanceMethod(dClass, newSelector); 22 | //将 newMethod的实现 添加到系统方法中 也就是说 将 originalMethod方法指针添加成 23 | //方法newMethod的 返回值表示是否添加成功 24 | BOOL isAdd = class_addMethod(dClass, originalSelector, 25 | method_getImplementation(newMethod), 26 | method_getTypeEncoding(newMethod)); 27 | //添加成功了 说明 本类中不存在新方法 28 | //所以此时必须将新方法的实现指针换成原方法的,否则 新方法将没有实现。 29 | if (isAdd) { 30 | class_replaceMethod(dClass, newSelector, 31 | method_getImplementation(originalMethod), 32 | method_getTypeEncoding(originalMethod)); 33 | } else { 34 | //添加失败了 说明本类中 有methodB的实现,此时只需要将 35 | // originalMethod和newMethod的IMP互换一下即可。 36 | method_exchangeImplementations(originalMethod, newMethod); 37 | } 38 | 39 | } 40 | +(void)load 41 | { 42 | Class dClass=[self class]; 43 | [self ls_navBar_exchangeInstanceMethod:dClass originalSel:@selector(pushNavigationItem:) newSel:@selector(ls_pushNavigationItem:)]; 44 | [self ls_navBar_exchangeInstanceMethod:dClass originalSel:@selector(pushNavigationItem:animated:) newSel:@selector(ls_pushNavigationItem:animated:)]; 45 | 46 | } 47 | 48 | 49 | -(void)ls_pushNavigationItem:(UINavigationItem *)item 50 | { 51 | if ([self isKindOfClass:[LSTopNavigationBar class]]) { 52 | item=[[UINavigationItem alloc]init]; 53 | item.leftBarButtonItem=[UIBarButtonItem new]; 54 | } 55 | [self ls_pushNavigationItem:item]; 56 | } 57 | 58 | -(void)ls_pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated 59 | { 60 | if ([self isKindOfClass:[LSTopNavigationBar class]]) { 61 | item=[[UINavigationItem alloc]init]; 62 | } 63 | [self ls_pushNavigationItem:item animated:animated]; 64 | } 65 | 66 | 67 | @end 68 | 69 | 70 | 71 | @implementation UIView (LSNavigationController) 72 | 73 | +(void)load{ 74 | [UINavigationBar ls_navBar_exchangeInstanceMethod:[self class] originalSel:@selector(didAddSubview:) newSel:@selector(ls_didAddSubview:)]; 75 | } 76 | -(BOOL)ls_isViewControllerBaseView{ 77 | return [objc_getAssociatedObject(self, _cmd) boolValue]; 78 | } 79 | 80 | -(void)setLs_isViewControllerBaseView:(BOOL)ls_isViewControllerBaseView{ 81 | objc_setAssociatedObject(self, @selector(ls_isViewControllerBaseView), @(ls_isViewControllerBaseView), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 82 | } 83 | -(void)setViewLevel:(UIViewLevel)viewLevel{ 84 | objc_setAssociatedObject(self, @selector(viewLevel), @(viewLevel), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 85 | } 86 | 87 | -(UIViewLevel)viewLevel{ 88 | return [objc_getAssociatedObject(self, _cmd) integerValue]; 89 | } 90 | 91 | 92 | -(void)ls_didAddSubview:(UIView *)subview 93 | { 94 | [self ls_didAddSubview:subview]; 95 | if (self.ls_isViewControllerBaseView) { 96 | if (subview.viewLevel==UIViewLevelHigh) { 97 | return; 98 | } 99 | UIViewController *vc= (UIViewController*)[self nextResponder]; 100 | if ([vc isKindOfClass:[UIViewController class]]) { 101 | if(vc.navigationBar){ 102 | [self bringSubviewToFront:vc.navigationBar]; 103 | } 104 | } 105 | } 106 | } 107 | @end 108 | 109 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController基类实现/LSViewController.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // LSViewController.m 5 | // LSNavigationController 6 | // 7 | // Created by liusong on 2018/3/27. 8 | // Copyright © 2018年 liusong. All rights reserved. 9 | // 10 | 11 | #import "LSViewController.h" 12 | #import "UIView+LSNavigationController.h" 13 | #import "LSNavigationBar.h" 14 | @interface LSViewController () 15 | @property (nonatomic,strong) LSNavigationItem *item; 16 | @property (nonatomic,weak) LSNavigationController *ls_navigationController; 17 | @end 18 | 19 | @implementation LSViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | self.edgesForExtendedLayout=UIRectEdgeNone;//代表从64开始 top 从0开始 25 | [self reloadNavigationBar]; 26 | } 27 | 28 | -(LSNavigationBar *)navigationBar{ 29 | 30 | if (_navigationBar==nil) { 31 | [self reloadNavigationBar]; 32 | } 33 | return _navigationBar; 34 | } 35 | -(void)removeNavigationBar 36 | { 37 | if (_navigationBar) { 38 | [_navigationBar removeFromSuperview]; 39 | _item=nil; 40 | } 41 | } 42 | -(void)reloadNavigationBar 43 | { 44 | [self removeNavigationBar]; 45 | CGSize size = [UIApplication sharedApplication].statusBarFrame.size; 46 | LSNavigationBar *navigationBar=[[LSNavigationBar alloc]init]; 47 | if (self.edgesForExtendedLayout==UIRectEdgeNone) { 48 | navigationBar.frame=CGRectMake(0, -44, size.width, 44); 49 | self.view.clipsToBounds=NO; 50 | self.view.ls_nav_enlargeTop=YES; 51 | }else{ 52 | navigationBar.frame=CGRectMake(0, size.height, size.width, 44); 53 | } 54 | 55 | [self.view addSubview:navigationBar]; 56 | _navigationBar=navigationBar; 57 | // navigationBar.items=@[self.item]; 58 | [_navigationBar pushNavigationItem:self.item animated:NO]; 59 | 60 | [self setDefaultBackItem]; 61 | } 62 | 63 | -(void)setDefaultBackItem 64 | { 65 | //设置返回item 66 | if (self.navigationController.viewControllers.count>1){ 67 | UIBarButtonItem *leftItem=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"navBar_back_icon"] style:(UIBarButtonItemStylePlain) target:self action:@selector(navigationBarClickBack)]; 68 | self.item.leftBarButtonItem=leftItem; 69 | } 70 | 71 | } 72 | -(void)setCancelAllGesture:(BOOL)cancelAllGesture 73 | { 74 | LSNavigationController *nav=self.ls_navigationController; 75 | nav.cancelGesture=cancelAllGesture; 76 | } 77 | 78 | //判断如果是页面是navigationController中的第一个页面就禁止左划手势,不然在第一个页面执行左划手势后在push不到第二个页面 79 | -(void)viewDidAppear:(BOOL)animated 80 | { 81 | [super viewDidAppear:animated]; 82 | if (self.navigationController.viewControllers.firstObject == self) { 83 | //在根控制器界面 84 | self.navigationController.interactivePopGestureRecognizer.enabled = NO; 85 | }else{ 86 | LSNavigationController *nav=(LSNavigationController*)self.navigationController; 87 | //不在跟控制界面 88 | if (nav.cancelGesture) { 89 | self.navigationController.interactivePopGestureRecognizer.enabled=NO; 90 | }else{ 91 | self.navigationController.interactivePopGestureRecognizer.enabled = !self.cancelGesture; 92 | } 93 | } 94 | } 95 | -(void)setCancelGesture:(BOOL)cancelGesture 96 | { 97 | _cancelGesture=cancelGesture; 98 | if (!((LSNavigationController*)self.navigationController).cancelGesture) { 99 | //导航控制器没有全局取消 直接设置 100 | self.navigationController.interactivePopGestureRecognizer.enabled=!cancelGesture; 101 | } 102 | } 103 | -(void)bringNavigationBarToFront 104 | { 105 | [self.view bringSubviewToFront:self.navigationBar]; 106 | } 107 | 108 | -(void)navigationBarClickBack 109 | { 110 | [self.navigationController popViewControllerAnimated:YES]; 111 | } 112 | 113 | -(UINavigationItem *)item 114 | { 115 | if (_item==nil) { 116 | _item=[[LSNavigationItem alloc]init]; 117 | } 118 | return _item; 119 | } 120 | -(UINavigationItem *)navigationItem{ 121 | return self.item; 122 | } 123 | 124 | -(void)setTitle:(NSString *)title 125 | { 126 | [super setTitle:title]; 127 | self.item.title=title; 128 | } 129 | -(void)viewDidLayoutSubviews 130 | { 131 | [super viewDidLayoutSubviews]; 132 | [self bringNavigationBarToFront ]; 133 | } 134 | 135 | - (UIImage*)imageWithColor:(UIColor*)color 136 | { 137 | CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 138 | UIGraphicsBeginImageContext(rect.size); 139 | CGContextRef context = UIGraphicsGetCurrentContext(); 140 | CGContextSetFillColorWithColor(context, [color CGColor]); 141 | CGContextFillRect(context, rect); 142 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 143 | UIGraphicsEndImageContext(); 144 | 145 | return newImage; 146 | } 147 | 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/LSNavigationController/UIViewController+LSNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+LSNavigationController.m 3 | // LSNavigationController 4 | // 5 | // Created by liusong on 2018/3/30. 6 | // Copyright © 2018年 liusong. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+LSNavigationController.h" 10 | #import 11 | #import "LSNavigationController.h" 12 | #import "UINavigationBar+LSNavigationController.h" 13 | 14 | 15 | @interface UIViewController () 16 | 17 | 18 | @property (nonatomic,weak) LSNavigationController *ls_navigationController; 19 | @property (nonatomic,strong) LSNavigationItem *ls_navigation_item; 20 | 21 | @end 22 | 23 | @implementation UIViewController (LSNavigationController) 24 | 25 | +(void)load{ 26 | 27 | [UINavigationBar ls_navBar_exchangeInstanceMethod:[self class] originalSel:@selector(viewDidAppear:) newSel:@selector(ls_viewDidAppear:)]; 28 | 29 | [UINavigationBar ls_navBar_exchangeInstanceMethod:[self class] originalSel:@selector(navigationItem) newSel:@selector(ls_navigationItem)]; 30 | 31 | [UINavigationBar ls_navBar_exchangeInstanceMethod:[self class] originalSel:@selector(setTitle:) newSel:@selector(ls_setTitle:)]; 32 | 33 | } 34 | 35 | //#pragma mark - 以下为方法替换 36 | -(void)ls_setTitle:(NSString *)title 37 | { 38 | [self ls_setTitle:title]; 39 | if (self.ls_navigation_item) { 40 | self.ls_navigation_item.title=title; 41 | } 42 | } 43 | 44 | 45 | -(void)ls_viewDidAppear:(BOOL)animated 46 | { 47 | [self ls_viewDidAppear:animated]; 48 | //只有通过LSNavigationController push过来的VC才做此设置 49 | if (self.ls_navigationController) { 50 | if (self.navigationController.viewControllers.firstObject == self) { 51 | //在根控制器界面 52 | self.navigationController.interactivePopGestureRecognizer.enabled = NO; 53 | }else{ 54 | LSNavigationController *nav=(LSNavigationController*)self.navigationController; 55 | //不在跟控制界面 56 | if (nav.cancelGesture) { 57 | self.navigationController.interactivePopGestureRecognizer.enabled=NO; 58 | }else{ 59 | self.navigationController.interactivePopGestureRecognizer.enabled = !self.cancelGesture; 60 | } 61 | } 62 | } 63 | } 64 | 65 | -(UINavigationItem *)ls_navigationItem 66 | { 67 | if (self.ls_navigation_item) { 68 | return self.ls_navigation_item; 69 | } 70 | return [self ls_navigationItem]; 71 | } 72 | 73 | #pragma mark - 以下为私有方法 74 | -(void)bringNavigationBarToFront 75 | { 76 | [self.view bringSubviewToFront:self.navigationBar]; 77 | } 78 | 79 | -(void)removeNavigationBar 80 | { 81 | if (self.navigationBar) { 82 | [self.navigationBar removeFromSuperview]; 83 | self.ls_navigation_item=nil; 84 | } 85 | } 86 | -(void)reloadNavigationBar 87 | { 88 | [self removeNavigationBar]; 89 | CGSize size = [UIApplication sharedApplication].statusBarFrame.size; 90 | LSNavigationBar *navigationBar=[[LSNavigationBar alloc]init]; 91 | 92 | self.edgesForExtendedLayout=UIRectEdgeTop; 93 | navigationBar.frame=CGRectMake(0, size.height, size.width, 44); 94 | self.view.ls_isViewControllerBaseView=YES; 95 | 96 | self.navigationBar=navigationBar; 97 | [self.view addSubview:navigationBar]; 98 | self.ls_navigation_item=[[LSNavigationItem alloc]init]; 99 | navigationBar.items=@[self.ls_navigation_item]; 100 | } 101 | 102 | - (UIImage*)ls_imageWithColor:(UIColor*)color 103 | { 104 | CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 105 | UIGraphicsBeginImageContext(rect.size); 106 | CGContextRef context = UIGraphicsGetCurrentContext(); 107 | CGContextSetFillColorWithColor(context, [color CGColor]); 108 | CGContextFillRect(context, rect); 109 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 110 | UIGraphicsEndImageContext(); 111 | return newImage; 112 | } 113 | 114 | #pragma mark - 以下为增加属性 115 | -(void)setLs_navigation_item:(LSNavigationItem *)ls_navigation_item 116 | { 117 | objc_setAssociatedObject(self, @selector(ls_navigation_item), ls_navigation_item, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 118 | } 119 | -(LSNavigationItem *)ls_navigation_item 120 | { 121 | return objc_getAssociatedObject(self, _cmd); 122 | } 123 | 124 | -(LSNavigationController *)ls_navigationController 125 | { 126 | return objc_getAssociatedObject(self, _cmd); 127 | } 128 | -(void)setLs_navigationController:(LSNavigationController *)ls_navigationController 129 | { 130 | objc_setAssociatedObject(self, @selector(ls_navigationController), ls_navigationController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 131 | } 132 | 133 | -(void)setNavigationBar:(LSNavigationBar *)navigationBar 134 | { 135 | objc_setAssociatedObject(self, @selector(navigationBar), navigationBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 136 | } 137 | 138 | -(LSNavigationBar *)navigationBar 139 | { 140 | return objc_getAssociatedObject(self, _cmd); 141 | } 142 | 143 | -(void)setCancelGesture:(BOOL)cancelGesture 144 | { 145 | objc_setAssociatedObject(self, @selector(cancelGesture), @(cancelGesture), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 146 | if (!((LSNavigationController*)self.navigationController).cancelGesture) { 147 | //导航控制器没有全局取消 直接设置 148 | self.navigationController.interactivePopGestureRecognizer.enabled=!cancelGesture; 149 | } 150 | } 151 | 152 | -(BOOL)cancelGesture 153 | { 154 | return [objc_getAssociatedObject(self, _cmd) boolValue]; 155 | } 156 | 157 | 158 | 159 | @end 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 36 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /LSNavigationController/LSNavigationController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 281A3EEF206CC27200861356 /* OneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 281A3EEE206CC27200861356 /* OneViewController.m */; }; 11 | 281C21DE206B6EEA007BAC2E /* ThreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 281C21DC206B6EEA007BAC2E /* ThreeViewController.m */; }; 12 | 281C21DF206B6EEA007BAC2E /* ThreeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 281C21DD206B6EEA007BAC2E /* ThreeViewController.xib */; }; 13 | 2826403B2069E9E900C82A2E /* TwoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2826403A2069E9E900C82A2E /* TwoViewController.m */; }; 14 | 287D29B720637C6D0004F2C0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 287D29B620637C6D0004F2C0 /* AppDelegate.m */; }; 15 | 287D29BD20637C6E0004F2C0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 287D29BB20637C6E0004F2C0 /* Main.storyboard */; }; 16 | 287D29BF20637C6E0004F2C0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 287D29BE20637C6E0004F2C0 /* Assets.xcassets */; }; 17 | 287D29C220637C6E0004F2C0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 287D29C020637C6E0004F2C0 /* LaunchScreen.storyboard */; }; 18 | 287D29C520637C6E0004F2C0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 287D29C420637C6E0004F2C0 /* main.m */; }; 19 | 287D29CF20637C6E0004F2C0 /* LSNavigationControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 287D29CE20637C6E0004F2C0 /* LSNavigationControllerTests.m */; }; 20 | 287D29DA20637C6E0004F2C0 /* LSNavigationControllerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 287D29D920637C6E0004F2C0 /* LSNavigationControllerUITests.m */; }; 21 | 2886E8B521117AED002B42A4 /* FourViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2886E8B321117AED002B42A4 /* FourViewController.m */; }; 22 | 2886E8B621117AED002B42A4 /* FourViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2886E8B421117AED002B42A4 /* FourViewController.xib */; }; 23 | 28CDB1282071F46600C268CA /* LSNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28CDB11E2071F46600C268CA /* LSNavigationController.m */; }; 24 | 28CDB1292071F46600C268CA /* UINavigationBar+LSNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28CDB11F2071F46600C268CA /* UINavigationBar+LSNavigationController.m */; }; 25 | 28CDB12C2071F46600C268CA /* UIViewController+LSNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28CDB1262071F46600C268CA /* UIViewController+LSNavigationController.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 287D29CB20637C6E0004F2C0 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 287D29AA20637C6D0004F2C0 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 287D29B120637C6D0004F2C0; 34 | remoteInfo = LSNavigationController; 35 | }; 36 | 287D29D620637C6E0004F2C0 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 287D29AA20637C6D0004F2C0 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = 287D29B120637C6D0004F2C0; 41 | remoteInfo = LSNavigationController; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | 281A3EED206CC27200861356 /* OneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneViewController.h; sourceTree = ""; }; 47 | 281A3EEE206CC27200861356 /* OneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneViewController.m; sourceTree = ""; }; 48 | 281C21DB206B6EEA007BAC2E /* ThreeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeViewController.h; sourceTree = ""; }; 49 | 281C21DC206B6EEA007BAC2E /* ThreeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThreeViewController.m; sourceTree = ""; }; 50 | 281C21DD206B6EEA007BAC2E /* ThreeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ThreeViewController.xib; sourceTree = ""; }; 51 | 282640392069E9E900C82A2E /* TwoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TwoViewController.h; sourceTree = ""; }; 52 | 2826403A2069E9E900C82A2E /* TwoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TwoViewController.m; sourceTree = ""; }; 53 | 287D29B220637C6D0004F2C0 /* LSNavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LSNavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 287D29B520637C6D0004F2C0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 55 | 287D29B620637C6D0004F2C0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 56 | 287D29BC20637C6E0004F2C0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 287D29BE20637C6E0004F2C0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 287D29C120637C6E0004F2C0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 287D29C320637C6E0004F2C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 287D29C420637C6E0004F2C0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 61 | 287D29CA20637C6E0004F2C0 /* LSNavigationControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LSNavigationControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 287D29CE20637C6E0004F2C0 /* LSNavigationControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LSNavigationControllerTests.m; sourceTree = ""; }; 63 | 287D29D020637C6E0004F2C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 287D29D520637C6E0004F2C0 /* LSNavigationControllerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LSNavigationControllerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 65 | 287D29D920637C6E0004F2C0 /* LSNavigationControllerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LSNavigationControllerUITests.m; sourceTree = ""; }; 66 | 287D29DB20637C6E0004F2C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | 2886E8B221117AED002B42A4 /* FourViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FourViewController.h; sourceTree = ""; }; 68 | 2886E8B321117AED002B42A4 /* FourViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FourViewController.m; sourceTree = ""; }; 69 | 2886E8B421117AED002B42A4 /* FourViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FourViewController.xib; sourceTree = ""; }; 70 | 28CDB11E2071F46600C268CA /* LSNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LSNavigationController.m; sourceTree = ""; }; 71 | 28CDB11F2071F46600C268CA /* UINavigationBar+LSNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+LSNavigationController.m"; sourceTree = ""; }; 72 | 28CDB1222071F46600C268CA /* UIViewController+LSNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+LSNavigationController.h"; sourceTree = ""; }; 73 | 28CDB1232071F46600C268CA /* UINavigationBar+LSNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+LSNavigationController.h"; sourceTree = ""; }; 74 | 28CDB1242071F46600C268CA /* LSNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LSNavigationController.h; sourceTree = ""; }; 75 | 28CDB1262071F46600C268CA /* UIViewController+LSNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+LSNavigationController.m"; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 287D29AF20637C6D0004F2C0 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 287D29C720637C6E0004F2C0 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | 287D29D220637C6E0004F2C0 /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | /* End PBXFrameworksBuildPhase section */ 101 | 102 | /* Begin PBXGroup section */ 103 | 287D29A920637C6D0004F2C0 = { 104 | isa = PBXGroup; 105 | children = ( 106 | 287D29B420637C6D0004F2C0 /* LSNavigationController */, 107 | 287D29CD20637C6E0004F2C0 /* LSNavigationControllerTests */, 108 | 287D29D820637C6E0004F2C0 /* LSNavigationControllerUITests */, 109 | 287D29B320637C6D0004F2C0 /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 287D29B320637C6D0004F2C0 /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 287D29B220637C6D0004F2C0 /* LSNavigationController.app */, 117 | 287D29CA20637C6E0004F2C0 /* LSNavigationControllerTests.xctest */, 118 | 287D29D520637C6E0004F2C0 /* LSNavigationControllerUITests.xctest */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | 287D29B420637C6D0004F2C0 /* LSNavigationController */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 28CDB11D2071F46600C268CA /* LSNavigationController */, 127 | 287D29B520637C6D0004F2C0 /* AppDelegate.h */, 128 | 287D29B620637C6D0004F2C0 /* AppDelegate.m */, 129 | 281A3EED206CC27200861356 /* OneViewController.h */, 130 | 281A3EEE206CC27200861356 /* OneViewController.m */, 131 | 282640392069E9E900C82A2E /* TwoViewController.h */, 132 | 2826403A2069E9E900C82A2E /* TwoViewController.m */, 133 | 281C21DB206B6EEA007BAC2E /* ThreeViewController.h */, 134 | 281C21DC206B6EEA007BAC2E /* ThreeViewController.m */, 135 | 281C21DD206B6EEA007BAC2E /* ThreeViewController.xib */, 136 | 2886E8B221117AED002B42A4 /* FourViewController.h */, 137 | 2886E8B321117AED002B42A4 /* FourViewController.m */, 138 | 2886E8B421117AED002B42A4 /* FourViewController.xib */, 139 | 287D29BB20637C6E0004F2C0 /* Main.storyboard */, 140 | 287D29BE20637C6E0004F2C0 /* Assets.xcassets */, 141 | 287D29C020637C6E0004F2C0 /* LaunchScreen.storyboard */, 142 | 287D29C320637C6E0004F2C0 /* Info.plist */, 143 | 287D29C420637C6E0004F2C0 /* main.m */, 144 | ); 145 | path = LSNavigationController; 146 | sourceTree = ""; 147 | }; 148 | 287D29CD20637C6E0004F2C0 /* LSNavigationControllerTests */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 287D29CE20637C6E0004F2C0 /* LSNavigationControllerTests.m */, 152 | 287D29D020637C6E0004F2C0 /* Info.plist */, 153 | ); 154 | path = LSNavigationControllerTests; 155 | sourceTree = ""; 156 | }; 157 | 287D29D820637C6E0004F2C0 /* LSNavigationControllerUITests */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | 287D29D920637C6E0004F2C0 /* LSNavigationControllerUITests.m */, 161 | 287D29DB20637C6E0004F2C0 /* Info.plist */, 162 | ); 163 | path = LSNavigationControllerUITests; 164 | sourceTree = ""; 165 | }; 166 | 28CDB11D2071F46600C268CA /* LSNavigationController */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 28CDB1242071F46600C268CA /* LSNavigationController.h */, 170 | 28CDB11E2071F46600C268CA /* LSNavigationController.m */, 171 | 28CDB1222071F46600C268CA /* UIViewController+LSNavigationController.h */, 172 | 28CDB1262071F46600C268CA /* UIViewController+LSNavigationController.m */, 173 | 28CDB1232071F46600C268CA /* UINavigationBar+LSNavigationController.h */, 174 | 28CDB11F2071F46600C268CA /* UINavigationBar+LSNavigationController.m */, 175 | ); 176 | path = LSNavigationController; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXGroup section */ 180 | 181 | /* Begin PBXNativeTarget section */ 182 | 287D29B120637C6D0004F2C0 /* LSNavigationController */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = 287D29DE20637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationController" */; 185 | buildPhases = ( 186 | 287D29AE20637C6D0004F2C0 /* Sources */, 187 | 287D29AF20637C6D0004F2C0 /* Frameworks */, 188 | 287D29B020637C6D0004F2C0 /* Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | ); 194 | name = LSNavigationController; 195 | productName = LSNavigationController; 196 | productReference = 287D29B220637C6D0004F2C0 /* LSNavigationController.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | 287D29C920637C6E0004F2C0 /* LSNavigationControllerTests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 287D29E120637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationControllerTests" */; 202 | buildPhases = ( 203 | 287D29C620637C6E0004F2C0 /* Sources */, 204 | 287D29C720637C6E0004F2C0 /* Frameworks */, 205 | 287D29C820637C6E0004F2C0 /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 287D29CC20637C6E0004F2C0 /* PBXTargetDependency */, 211 | ); 212 | name = LSNavigationControllerTests; 213 | productName = LSNavigationControllerTests; 214 | productReference = 287D29CA20637C6E0004F2C0 /* LSNavigationControllerTests.xctest */; 215 | productType = "com.apple.product-type.bundle.unit-test"; 216 | }; 217 | 287D29D420637C6E0004F2C0 /* LSNavigationControllerUITests */ = { 218 | isa = PBXNativeTarget; 219 | buildConfigurationList = 287D29E420637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationControllerUITests" */; 220 | buildPhases = ( 221 | 287D29D120637C6E0004F2C0 /* Sources */, 222 | 287D29D220637C6E0004F2C0 /* Frameworks */, 223 | 287D29D320637C6E0004F2C0 /* Resources */, 224 | ); 225 | buildRules = ( 226 | ); 227 | dependencies = ( 228 | 287D29D720637C6E0004F2C0 /* PBXTargetDependency */, 229 | ); 230 | name = LSNavigationControllerUITests; 231 | productName = LSNavigationControllerUITests; 232 | productReference = 287D29D520637C6E0004F2C0 /* LSNavigationControllerUITests.xctest */; 233 | productType = "com.apple.product-type.bundle.ui-testing"; 234 | }; 235 | /* End PBXNativeTarget section */ 236 | 237 | /* Begin PBXProject section */ 238 | 287D29AA20637C6D0004F2C0 /* Project object */ = { 239 | isa = PBXProject; 240 | attributes = { 241 | LastUpgradeCheck = 0910; 242 | ORGANIZATIONNAME = liusong; 243 | TargetAttributes = { 244 | 287D29B120637C6D0004F2C0 = { 245 | CreatedOnToolsVersion = 9.1; 246 | ProvisioningStyle = Automatic; 247 | }; 248 | 287D29C920637C6E0004F2C0 = { 249 | CreatedOnToolsVersion = 9.1; 250 | ProvisioningStyle = Automatic; 251 | TestTargetID = 287D29B120637C6D0004F2C0; 252 | }; 253 | 287D29D420637C6E0004F2C0 = { 254 | CreatedOnToolsVersion = 9.1; 255 | ProvisioningStyle = Automatic; 256 | TestTargetID = 287D29B120637C6D0004F2C0; 257 | }; 258 | }; 259 | }; 260 | buildConfigurationList = 287D29AD20637C6D0004F2C0 /* Build configuration list for PBXProject "LSNavigationController" */; 261 | compatibilityVersion = "Xcode 8.0"; 262 | developmentRegion = en; 263 | hasScannedForEncodings = 0; 264 | knownRegions = ( 265 | en, 266 | Base, 267 | ); 268 | mainGroup = 287D29A920637C6D0004F2C0; 269 | productRefGroup = 287D29B320637C6D0004F2C0 /* Products */; 270 | projectDirPath = ""; 271 | projectRoot = ""; 272 | targets = ( 273 | 287D29B120637C6D0004F2C0 /* LSNavigationController */, 274 | 287D29C920637C6E0004F2C0 /* LSNavigationControllerTests */, 275 | 287D29D420637C6E0004F2C0 /* LSNavigationControllerUITests */, 276 | ); 277 | }; 278 | /* End PBXProject section */ 279 | 280 | /* Begin PBXResourcesBuildPhase section */ 281 | 287D29B020637C6D0004F2C0 /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 287D29C220637C6E0004F2C0 /* LaunchScreen.storyboard in Resources */, 286 | 2886E8B621117AED002B42A4 /* FourViewController.xib in Resources */, 287 | 287D29BF20637C6E0004F2C0 /* Assets.xcassets in Resources */, 288 | 287D29BD20637C6E0004F2C0 /* Main.storyboard in Resources */, 289 | 281C21DF206B6EEA007BAC2E /* ThreeViewController.xib in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 287D29C820637C6E0004F2C0 /* Resources */ = { 294 | isa = PBXResourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | 287D29D320637C6E0004F2C0 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | /* End PBXResourcesBuildPhase section */ 308 | 309 | /* Begin PBXSourcesBuildPhase section */ 310 | 287D29AE20637C6D0004F2C0 /* Sources */ = { 311 | isa = PBXSourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | 28CDB1282071F46600C268CA /* LSNavigationController.m in Sources */, 315 | 2826403B2069E9E900C82A2E /* TwoViewController.m in Sources */, 316 | 287D29C520637C6E0004F2C0 /* main.m in Sources */, 317 | 28CDB1292071F46600C268CA /* UINavigationBar+LSNavigationController.m in Sources */, 318 | 281C21DE206B6EEA007BAC2E /* ThreeViewController.m in Sources */, 319 | 28CDB12C2071F46600C268CA /* UIViewController+LSNavigationController.m in Sources */, 320 | 281A3EEF206CC27200861356 /* OneViewController.m in Sources */, 321 | 2886E8B521117AED002B42A4 /* FourViewController.m in Sources */, 322 | 287D29B720637C6D0004F2C0 /* AppDelegate.m in Sources */, 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | }; 326 | 287D29C620637C6E0004F2C0 /* Sources */ = { 327 | isa = PBXSourcesBuildPhase; 328 | buildActionMask = 2147483647; 329 | files = ( 330 | 287D29CF20637C6E0004F2C0 /* LSNavigationControllerTests.m in Sources */, 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | }; 334 | 287D29D120637C6E0004F2C0 /* Sources */ = { 335 | isa = PBXSourcesBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | 287D29DA20637C6E0004F2C0 /* LSNavigationControllerUITests.m in Sources */, 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | }; 342 | /* End PBXSourcesBuildPhase section */ 343 | 344 | /* Begin PBXTargetDependency section */ 345 | 287D29CC20637C6E0004F2C0 /* PBXTargetDependency */ = { 346 | isa = PBXTargetDependency; 347 | target = 287D29B120637C6D0004F2C0 /* LSNavigationController */; 348 | targetProxy = 287D29CB20637C6E0004F2C0 /* PBXContainerItemProxy */; 349 | }; 350 | 287D29D720637C6E0004F2C0 /* PBXTargetDependency */ = { 351 | isa = PBXTargetDependency; 352 | target = 287D29B120637C6D0004F2C0 /* LSNavigationController */; 353 | targetProxy = 287D29D620637C6E0004F2C0 /* PBXContainerItemProxy */; 354 | }; 355 | /* End PBXTargetDependency section */ 356 | 357 | /* Begin PBXVariantGroup section */ 358 | 287D29BB20637C6E0004F2C0 /* Main.storyboard */ = { 359 | isa = PBXVariantGroup; 360 | children = ( 361 | 287D29BC20637C6E0004F2C0 /* Base */, 362 | ); 363 | name = Main.storyboard; 364 | sourceTree = ""; 365 | }; 366 | 287D29C020637C6E0004F2C0 /* LaunchScreen.storyboard */ = { 367 | isa = PBXVariantGroup; 368 | children = ( 369 | 287D29C120637C6E0004F2C0 /* Base */, 370 | ); 371 | name = LaunchScreen.storyboard; 372 | sourceTree = ""; 373 | }; 374 | /* End PBXVariantGroup section */ 375 | 376 | /* Begin XCBuildConfiguration section */ 377 | 287D29DC20637C6E0004F2C0 /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ALWAYS_SEARCH_USER_PATHS = NO; 381 | CLANG_ANALYZER_NONNULL = YES; 382 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_MODULES = YES; 386 | CLANG_ENABLE_OBJC_ARC = YES; 387 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 388 | CLANG_WARN_BOOL_CONVERSION = YES; 389 | CLANG_WARN_COMMA = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 393 | CLANG_WARN_EMPTY_BODY = YES; 394 | CLANG_WARN_ENUM_CONVERSION = YES; 395 | CLANG_WARN_INFINITE_RECURSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 399 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 400 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 401 | CLANG_WARN_STRICT_PROTOTYPES = YES; 402 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 403 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 404 | CLANG_WARN_UNREACHABLE_CODE = YES; 405 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 406 | CODE_SIGN_IDENTITY = "iPhone Developer"; 407 | COPY_PHASE_STRIP = NO; 408 | DEBUG_INFORMATION_FORMAT = dwarf; 409 | ENABLE_STRICT_OBJC_MSGSEND = YES; 410 | ENABLE_TESTABILITY = YES; 411 | GCC_C_LANGUAGE_STANDARD = gnu11; 412 | GCC_DYNAMIC_NO_PIC = NO; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_OPTIMIZATION_LEVEL = 0; 415 | GCC_PREPROCESSOR_DEFINITIONS = ( 416 | "DEBUG=1", 417 | "$(inherited)", 418 | ); 419 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 420 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 421 | GCC_WARN_UNDECLARED_SELECTOR = YES; 422 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 423 | GCC_WARN_UNUSED_FUNCTION = YES; 424 | GCC_WARN_UNUSED_VARIABLE = YES; 425 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 426 | MTL_ENABLE_DEBUG_INFO = YES; 427 | ONLY_ACTIVE_ARCH = YES; 428 | SDKROOT = iphoneos; 429 | }; 430 | name = Debug; 431 | }; 432 | 287D29DD20637C6E0004F2C0 /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ALWAYS_SEARCH_USER_PATHS = NO; 436 | CLANG_ANALYZER_NONNULL = YES; 437 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 438 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 439 | CLANG_CXX_LIBRARY = "libc++"; 440 | CLANG_ENABLE_MODULES = YES; 441 | CLANG_ENABLE_OBJC_ARC = YES; 442 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 443 | CLANG_WARN_BOOL_CONVERSION = YES; 444 | CLANG_WARN_COMMA = YES; 445 | CLANG_WARN_CONSTANT_CONVERSION = YES; 446 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 447 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 448 | CLANG_WARN_EMPTY_BODY = YES; 449 | CLANG_WARN_ENUM_CONVERSION = YES; 450 | CLANG_WARN_INFINITE_RECURSION = YES; 451 | CLANG_WARN_INT_CONVERSION = YES; 452 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 453 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 454 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 455 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 456 | CLANG_WARN_STRICT_PROTOTYPES = YES; 457 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 458 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 459 | CLANG_WARN_UNREACHABLE_CODE = YES; 460 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 461 | CODE_SIGN_IDENTITY = "iPhone Developer"; 462 | COPY_PHASE_STRIP = NO; 463 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 464 | ENABLE_NS_ASSERTIONS = NO; 465 | ENABLE_STRICT_OBJC_MSGSEND = YES; 466 | GCC_C_LANGUAGE_STANDARD = gnu11; 467 | GCC_NO_COMMON_BLOCKS = YES; 468 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 469 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 470 | GCC_WARN_UNDECLARED_SELECTOR = YES; 471 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 472 | GCC_WARN_UNUSED_FUNCTION = YES; 473 | GCC_WARN_UNUSED_VARIABLE = YES; 474 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 475 | MTL_ENABLE_DEBUG_INFO = NO; 476 | SDKROOT = iphoneos; 477 | VALIDATE_PRODUCT = YES; 478 | }; 479 | name = Release; 480 | }; 481 | 287D29DF20637C6E0004F2C0 /* Debug */ = { 482 | isa = XCBuildConfiguration; 483 | buildSettings = { 484 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 485 | CODE_SIGN_STYLE = Automatic; 486 | DEVELOPMENT_TEAM = 929467FPP6; 487 | INFOPLIST_FILE = LSNavigationController/Info.plist; 488 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationController; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | TARGETED_DEVICE_FAMILY = "1,2"; 493 | }; 494 | name = Debug; 495 | }; 496 | 287D29E020637C6E0004F2C0 /* Release */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | CODE_SIGN_STYLE = Automatic; 501 | DEVELOPMENT_TEAM = 929467FPP6; 502 | INFOPLIST_FILE = LSNavigationController/Info.plist; 503 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationController; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | TARGETED_DEVICE_FAMILY = "1,2"; 508 | }; 509 | name = Release; 510 | }; 511 | 287D29E220637C6E0004F2C0 /* Debug */ = { 512 | isa = XCBuildConfiguration; 513 | buildSettings = { 514 | BUNDLE_LOADER = "$(TEST_HOST)"; 515 | CODE_SIGN_STYLE = Automatic; 516 | DEVELOPMENT_TEAM = 929467FPP6; 517 | INFOPLIST_FILE = LSNavigationControllerTests/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 519 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationControllerTests; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | TARGETED_DEVICE_FAMILY = "1,2"; 522 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LSNavigationController.app/LSNavigationController"; 523 | }; 524 | name = Debug; 525 | }; 526 | 287D29E320637C6E0004F2C0 /* Release */ = { 527 | isa = XCBuildConfiguration; 528 | buildSettings = { 529 | BUNDLE_LOADER = "$(TEST_HOST)"; 530 | CODE_SIGN_STYLE = Automatic; 531 | DEVELOPMENT_TEAM = 929467FPP6; 532 | INFOPLIST_FILE = LSNavigationControllerTests/Info.plist; 533 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 534 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationControllerTests; 535 | PRODUCT_NAME = "$(TARGET_NAME)"; 536 | TARGETED_DEVICE_FAMILY = "1,2"; 537 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LSNavigationController.app/LSNavigationController"; 538 | }; 539 | name = Release; 540 | }; 541 | 287D29E520637C6E0004F2C0 /* Debug */ = { 542 | isa = XCBuildConfiguration; 543 | buildSettings = { 544 | CODE_SIGN_STYLE = Automatic; 545 | DEVELOPMENT_TEAM = 929467FPP6; 546 | INFOPLIST_FILE = LSNavigationControllerUITests/Info.plist; 547 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 548 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationControllerUITests; 549 | PRODUCT_NAME = "$(TARGET_NAME)"; 550 | TARGETED_DEVICE_FAMILY = "1,2"; 551 | TEST_TARGET_NAME = LSNavigationController; 552 | }; 553 | name = Debug; 554 | }; 555 | 287D29E620637C6E0004F2C0 /* Release */ = { 556 | isa = XCBuildConfiguration; 557 | buildSettings = { 558 | CODE_SIGN_STYLE = Automatic; 559 | DEVELOPMENT_TEAM = 929467FPP6; 560 | INFOPLIST_FILE = LSNavigationControllerUITests/Info.plist; 561 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 562 | PRODUCT_BUNDLE_IDENTIFIER = com.liusong.test.LSNavigationControllerUITests; 563 | PRODUCT_NAME = "$(TARGET_NAME)"; 564 | TARGETED_DEVICE_FAMILY = "1,2"; 565 | TEST_TARGET_NAME = LSNavigationController; 566 | }; 567 | name = Release; 568 | }; 569 | /* End XCBuildConfiguration section */ 570 | 571 | /* Begin XCConfigurationList section */ 572 | 287D29AD20637C6D0004F2C0 /* Build configuration list for PBXProject "LSNavigationController" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 287D29DC20637C6E0004F2C0 /* Debug */, 576 | 287D29DD20637C6E0004F2C0 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | 287D29DE20637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationController" */ = { 582 | isa = XCConfigurationList; 583 | buildConfigurations = ( 584 | 287D29DF20637C6E0004F2C0 /* Debug */, 585 | 287D29E020637C6E0004F2C0 /* Release */, 586 | ); 587 | defaultConfigurationIsVisible = 0; 588 | defaultConfigurationName = Release; 589 | }; 590 | 287D29E120637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationControllerTests" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | 287D29E220637C6E0004F2C0 /* Debug */, 594 | 287D29E320637C6E0004F2C0 /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | 287D29E420637C6E0004F2C0 /* Build configuration list for PBXNativeTarget "LSNavigationControllerUITests" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 287D29E520637C6E0004F2C0 /* Debug */, 603 | 287D29E620637C6E0004F2C0 /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | /* End XCConfigurationList section */ 609 | }; 610 | rootObject = 287D29AA20637C6D0004F2C0 /* Project object */; 611 | } 612 | --------------------------------------------------------------------------------