├── note.txt ├── .DS_Store ├── logo ├── logomark-black.png ├── logomark-color.png ├── logomark-white.png ├── vertical-black.png ├── vertical-color.png ├── vertical-white.png ├── horizontal-black.png ├── horizontal-color.png ├── horizontal-white.png ├── logomark.svg └── horizontal.svg ├── nav_preview ├── alpha.gif ├── hidden.gif ├── home@2x.png ├── operate.gif ├── sliding.gif └── statusBar.gif ├── EasyNavigation ├── .DS_Store ├── EasyNavButton │ ├── EasyNavButton.bundle │ │ ├── nav_btn_back@2x.png │ │ ├── nav_btn_back@3x.png │ │ ├── en.lproj │ │ │ └── Root.strings │ │ └── Root.plist │ ├── EasyNavigationView+LeftButton.h │ ├── EasyNavigationView+RightButton.h │ ├── EasyNavigationView+LeftButton.m │ └── EasyNavigationView+RightButton.m ├── EasyNavExt │ ├── EasyKVOInfo.m │ ├── UITableViewController+EasyNavigationExt.h │ ├── EasyKVOInfo.h │ ├── NSObject+EasyKVO.h │ ├── UITableViewController+EasyNavigationExt.m │ ├── UIScrollView+EasyNavigationExt.h │ ├── UIView+EasyNavigationExt.h │ ├── UIViewController+EasyNavigationExt.h │ ├── UIScrollView+EasyNavigationExt.m │ ├── UIView+EasyNavigationExt.m │ └── NSObject+EasyKVO.m ├── EasyNavigation.h ├── EasyNavigationController.h ├── EasyNavigationScroll.m ├── EasyNavigationScroll.h ├── EasyNavigationButton.h ├── EasyNavigationView+Scroll.h ├── EasyNavigationView+Add.h ├── EasyNavigationView+Scroll.m ├── EasyNavigationOptions.h ├── EasyNavigationUtils.m ├── EasyNavigationView+Add.m ├── EasyNavigationView.h ├── EasyNavigationOptions.m ├── EasyNavigationUtils.h └── EasyNavigationButton.m ├── EasyNavigationDemo ├── .DS_Store ├── Assets.xcassets │ ├── Contents.json │ ├── .DS_Store │ ├── button_normal.imageset │ │ ├── button_normal@2x.png │ │ ├── button_normal@3x.png │ │ └── Contents.json │ ├── button_select.imageset │ │ ├── button_select@2x.png │ │ ├── button_select@3x.png │ │ └── Contents.json │ ├── nav_btn_back.imageset │ │ ├── nav_btn_back@2x.png │ │ ├── nav_btn_back@3x.png │ │ └── Contents.json │ ├── nav_btn_back_blue.imageset │ │ ├── nav_btn_back_blue@2x.png │ │ ├── nav_btn_back_blue@3x.png │ │ └── Contents.json │ ├── nav_background_image.imageset │ │ ├── nav_background_image@2x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Alpha │ ├── .DS_Store │ ├── NavAlphaChangeViewController.h │ ├── NavTransparentViewController.h │ ├── NavAlphaChangeViewController.m │ └── NavTransparentViewController.m ├── Sliding │ ├── .DS_Store │ ├── NavCustomSlidingViewController.h │ ├── NavScrollIncludeViewController.h │ ├── NavSystemSlidingViewController.h │ ├── NavSystemSlidingViewController.m │ ├── NavScrollIncludeViewController.m │ ├── NavCustomSlidingViewController.m │ ├── NavSystemSlidingViewController.xib │ └── NavCustomSlidingViewController.xib ├── Bugly.framework │ ├── Bugly │ ├── Modules │ │ └── module.modulemap │ └── Headers │ │ ├── BuglyLog.h │ │ ├── BuglyConfig.h │ │ └── Bugly.h ├── ViewController.h ├── Hidden │ ├── NavEmptyViewController.h │ ├── NavSmoothHidenViewController.h │ ├── NavAnimationHidenViewController.h │ ├── NavSmoothHiden_1_ViewController.h │ ├── NavAnimationHiden_1_ViewController.h │ ├── NavEmptyViewController.m │ ├── NavSmoothHidenViewController.m │ ├── NavSmoothHiden_1_ViewController.m │ ├── NavAnimationHidenViewController.m │ └── NavAnimationHiden_1_ViewController.m ├── Operate │ ├── NavOperateViewController.h │ └── NavOperateViewController.m ├── StatusBar │ ├── NavStatusBarViewController.h │ ├── NavStatusBarViewController.m │ └── NavStatusBarViewController.xib ├── AppDelegate.h ├── BaseViewController.h ├── main.m ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── BaseViewController.m ├── AppDelegate.m └── ViewController.m ├── EasyNavigationDemo.xcodeproj ├── xcuserdata │ ├── bjhl.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ ├── frank.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ ├── nf.xcuserdatad │ │ ├── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── EasyNavigationDemo.xcscheme │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ └── Mr_Chen.xcuserdatad │ │ ├── xcschemes │ │ ├── xcschememanagement.plist │ │ └── EasyNavigationDemo.xcscheme │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ ├── nf.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ ├── bjhl.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ ├── frank.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ └── Mr_Chen.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── EasyNavigationDemoTests ├── Info.plist └── EasyNavigationDemoTests.m ├── EasyNavigationDemoUITests ├── Info.plist └── EasyNavigationDemoUITests.m ├── EasyNavigation.podspec ├── LICENSE └── README.md /note.txt: -------------------------------------------------------------------------------- 1 | 提示: 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/.DS_Store -------------------------------------------------------------------------------- /logo/logomark-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/logomark-black.png -------------------------------------------------------------------------------- /logo/logomark-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/logomark-color.png -------------------------------------------------------------------------------- /logo/logomark-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/logomark-white.png -------------------------------------------------------------------------------- /logo/vertical-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/vertical-black.png -------------------------------------------------------------------------------- /logo/vertical-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/vertical-color.png -------------------------------------------------------------------------------- /logo/vertical-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/vertical-white.png -------------------------------------------------------------------------------- /nav_preview/alpha.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/alpha.gif -------------------------------------------------------------------------------- /nav_preview/hidden.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/hidden.gif -------------------------------------------------------------------------------- /nav_preview/home@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/home@2x.png -------------------------------------------------------------------------------- /nav_preview/operate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/operate.gif -------------------------------------------------------------------------------- /nav_preview/sliding.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/sliding.gif -------------------------------------------------------------------------------- /EasyNavigation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigation/.DS_Store -------------------------------------------------------------------------------- /logo/horizontal-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/horizontal-black.png -------------------------------------------------------------------------------- /logo/horizontal-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/horizontal-color.png -------------------------------------------------------------------------------- /logo/horizontal-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/logo/horizontal-white.png -------------------------------------------------------------------------------- /nav_preview/statusBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/nav_preview/statusBar.gif -------------------------------------------------------------------------------- /EasyNavigationDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/.DS_Store -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EasyNavigationDemo/Alpha/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Alpha/.DS_Store -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Sliding/.DS_Store -------------------------------------------------------------------------------- /EasyNavigationDemo/Bugly.framework/Bugly: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Bugly.framework/Bugly -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavButton.bundle/nav_btn_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigation/EasyNavButton/EasyNavButton.bundle/nav_btn_back@2x.png -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavButton.bundle/nav_btn_back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigation/EasyNavButton/EasyNavButton.bundle/nav_btn_back@3x.png -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/bjhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavButton.bundle/en.lproj/Root.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigation/EasyNavButton/EasyNavButton.bundle/en.lproj/Root.strings -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_normal.imageset/button_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/button_normal.imageset/button_normal@2x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_normal.imageset/button_normal@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/button_normal.imageset/button_normal@3x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_select.imageset/button_select@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/button_select.imageset/button_select@2x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_select.imageset/button_select@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/button_select.imageset/button_select@3x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back.imageset/nav_btn_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/nav_btn_back.imageset/nav_btn_back@2x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back.imageset/nav_btn_back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/nav_btn_back.imageset/nav_btn_back@3x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back_blue.imageset/nav_btn_back_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/nav_btn_back_blue.imageset/nav_btn_back_blue@2x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back_blue.imageset/nav_btn_back_blue@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/nav_btn_back_blue.imageset/nav_btn_back_blue@3x.png -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_background_image.imageset/nav_background_image@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo/Assets.xcassets/nav_background_image.imageset/nav_background_image@2x.png -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/nf.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/nf.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/bjhl.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/bjhl.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/frank.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/frank.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/Mr_Chen.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyNavigation/HEAD/EasyNavigationDemo.xcodeproj/project.xcworkspace/xcuserdata/Mr_Chen.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/EasyKVOInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyKVOInfo.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyKVOInfo.h" 10 | 11 | @implementation EasyKVOInfo 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Bugly.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Bugly { 2 | umbrella header "Bugly.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | link framework "Foundation" 8 | link framework "Security" 9 | link framework "SystemConfiguration" 10 | link "c++" 11 | link "z" 12 | } 13 | -------------------------------------------------------------------------------- /EasyNavigationDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavEmptyViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavEmptyViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavEmptyViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Operate/NavOperateViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavOperateViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavOperateViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/StatusBar/NavStatusBarViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavStatusBarViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NavStatusBarViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Alpha/NavAlphaChangeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavAlphaChangeViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavAlphaChangeViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Alpha/NavTransparentViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavTransparentViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavTransparentViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavSmoothHidenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavSmoothHidenViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavSmoothHidenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavCustomSlidingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavCustomSlidingViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/15. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NavCustomSlidingViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavScrollIncludeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavScrollIncludeViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NavScrollIncludeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavSystemSlidingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavSystemSlidingViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/15. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NavSystemSlidingViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavAnimationHidenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavAnimationHidenViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavAnimationHidenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavSmoothHiden_1_ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavSmoothHiden_1_ViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavSmoothHiden_1_ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavAnimationHiden_1_ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavAnimationHiden_1_ViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NavAnimationHiden_1_ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyNavigationDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. 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 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UITableViewController+EasyNavigationExt.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewController+EasyNavigationExt.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/7/6. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITableViewController (EasyNavigationExt) 12 | 13 | //@property (nonatomic,strong)UITableView *tableView ; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/bjhl.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyNavigationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_background_image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_background_image@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/frank.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyNavigationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /EasyNavigationDemo/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyNavigation.h" 12 | 13 | #define kWeakSelf(type)__weak typeof(type)weak##type = type; 14 | 15 | @interface BaseViewController : UIViewController 16 | 17 | @property (nonatomic,strong,readonly)UITableView *tableView ; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "button_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "button_normal@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/button_select.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "button_select@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "button_select@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_btn_back@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "nav_btn_back@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /EasyNavigationDemo/Assets.xcassets/nav_btn_back_blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_btn_back_blue@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "nav_btn_back_blue@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/EasyKVOInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyKVOInfo.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^EasyKOVCallback)(id kvoObserver , NSString *kvoKey , id oldValue , id newValue ); 12 | 13 | @interface EasyKVOInfo : NSObject 14 | 15 | @property (nonatomic, weak) id observer; 16 | 17 | @property (nonatomic, copy) NSString *key; 18 | 19 | @property (nonatomic, copy) EasyKOVCallback callback; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/NSObject+EasyKVO.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+EasyKVO.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyKVOInfo.h" 12 | 13 | @interface NSObject (EasyKVO) 14 | 15 | - (void)easyAddObserver:(id)observer key:(NSString *)key callback:(EasyKOVCallback)callback ; 16 | - (void)easyRemoveObserver:(id)observer key:(NSString *)key ; 17 | @end 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigation.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigation.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #ifndef EasyNavigation_h 10 | #define EasyNavigation_h 11 | 12 | #import "EasyNavigationController.h" 13 | #import "EasyNavigationOptions.h" 14 | #import "UIViewController+EasyNavigationExt.h" 15 | #import "UIView+EasyNavigationExt.h" 16 | #import "EasyNavigationView+LeftButton.h" 17 | #import "EasyNavigationView+RightButton.h" 18 | #import "EasyNavigationView+Scroll.h" 19 | #import "EasyNavigationView+Add.h" 20 | 21 | #endif /* EasyNavigation_h */ 22 | -------------------------------------------------------------------------------- /EasyNavigationDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. 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 | //2018-05-29 23:53:03.826683+0800 EasyNavigationDemo[26593:2745554] dealoc > 18 | //2018-05-29 23:53:03.828819+0800 EasyNavigationDemo[26593:2745554] *** -[EasyNavigationView retain]: message sent to deallocated instance 0x7f8554095c80 19 | 20 | -------------------------------------------------------------------------------- /EasyNavigationDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /EasyNavigationDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UITableViewController+EasyNavigationExt.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewController+EasyNavigationExt.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/7/6. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "UITableViewController+EasyNavigationExt.h" 10 | #import 11 | 12 | //static char easynav_tableview = 'c'; 13 | 14 | @implementation UITableViewController (EasyNavigationExt) 15 | 16 | 17 | //- (UITableView *)tableView 18 | //{ 19 | // UITableView *tableView = objc_getAssociatedObject(self, &easynav_tableview); 20 | // return (tableView != nil) ? tableView : UITableView.new; 21 | //} 22 | //- (void)setTableView:(UITableView *)tableView 23 | //{ 24 | // objc_setAssociatedObject(self, &easynav_tableview, tableView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 25 | //} 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/nf.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyNavigationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6876E7551F5858CE00DEDFE0 16 | 17 | primary 18 | 19 | 20 | 6876E76E1F5858CF00DEDFE0 21 | 22 | primary 23 | 24 | 25 | 6876E7791F5858CF00DEDFE0 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /logo/logomark.svg: -------------------------------------------------------------------------------- 1 | logomark -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/Mr_Chen.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyNavigationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6876E7551F5858CE00DEDFE0 16 | 17 | primary 18 | 19 | 20 | 6876E76E1F5858CF00DEDFE0 21 | 22 | primary 23 | 24 | 25 | 6876E7791F5858CF00DEDFE0 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /EasyNavigation.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | 5 | s.name = "EasyNavigation" 6 | s.version = "1.0.5" 7 | s.summary = "一款超级简单的导航条管理工具,没有UINavigationBar和UINavigationItem这两个类。完全是对UIView的操作。 所有操作都能一行代码,操作之间完全独立,互不影响。" 8 | s.description = "一款超级简单的导航条管理工具。完全自定义导航条。没有UINavigationBar和UINavigationItem这两个类。完全是对UIView的操作。 所有操作都能一行代码,操作之间完全独立,互不影响。集成简单,使用简单。" 9 | s.homepage = "https://github.com/chenliangloveyou/EasyNavigation" 10 | s.license = "MIT" 11 | s.author = { "chenliangloveyou" => "ios_elite@163.com" } 12 | s.source = { :git => "https://github.com/chenliangloveyou/EasyNavigation.git", :commit => "daf7cf596e9354d6ac9d632562186bd27bf7133f" } 13 | s.source_files = "EasyNavigation/*.{h,m}" 14 | s.resource = 'EasyNavigation/EasyNavButton.bundle' 15 | # s.public_header_files = "Classes/**/*.h" 16 | s.ios.deployment_target= '7.0' 17 | 18 | 19 | end 20 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UIScrollView+EasyNavigationExt.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+EasyNavigationExt.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/13. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | typedef NS_ENUM(NSInteger ,EasyScrollDirection) { 13 | EasyScrollDirectionUnknow=0, 14 | EasyScrollDirectionUp,//向上滚动 15 | EasyScrollDirectionDown,//向下滚动 16 | 17 | }; 18 | 19 | @interface UIScrollView (EasyNavigationExt) 20 | 21 | /** 22 | * 开始改变方向标 23 | */ 24 | @property (nonatomic, assign)EasyScrollDirection Easy_direction; 25 | 26 | /** 27 | * 开始改变方向时scrollview的距离 28 | */ 29 | @property (nonatomic, assign)float Easy_scrollDistance ; 30 | 31 | /** 32 | * 是否正在动画 33 | */ 34 | //@property (nonatomic , assign)BOOL isScrolling ; 35 | 36 | 37 | @property (nonatomic, assign) BOOL Easy_enableDirection; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationController.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/10. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class EasyNavigationController ; 12 | 13 | @interface EasyCustomBackGestureDelegate : NSObject 14 | 15 | /** 16 | * 当前当行控制器 17 | */ 18 | @property (nonatomic,weak)EasyNavigationController *navController ; 19 | 20 | /** 21 | * 用来替换的系统手势事件 22 | */ 23 | @property (nonatomic,weak)id systemGestureTarget ; 24 | 25 | @end 26 | 27 | 28 | @interface EasyNavigationController : UINavigationController 29 | 30 | @property (nonatomic,assign)BOOL isSystemNavigationBar ;//是否展示自带的导航条 31 | 32 | @property (nonatomic,strong,readonly)UIPanGestureRecognizer *customBackGesture ;//自定义侧滑返回 33 | 34 | @property (nonatomic,strong,readonly)EasyCustomBackGestureDelegate *customBackGestureDelegate ;//自定义返回的代理 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UIView+EasyNavigationExt.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+EasyNavigationExt.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/11. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (EasyNavigationExt) 12 | 13 | 14 | @property (nonatomic) CGFloat Easy_x; 15 | @property (nonatomic) CGFloat Easy_y; 16 | @property(nonatomic) CGFloat Easy_width; 17 | @property(nonatomic) CGFloat Easy_height; 18 | 19 | @property(nonatomic) CGFloat Easy_centerX; 20 | @property(nonatomic) CGFloat Easy_centerY; 21 | 22 | @property(nonatomic,assign) CGFloat Easy_left; 23 | @property(nonatomic) CGFloat Easy_top; 24 | @property(nonatomic) CGFloat Easy_right; 25 | @property(nonatomic) CGFloat Easy_bottom; 26 | 27 | /** 28 | * 获取当前view所在的控制器 29 | */ 30 | - (UIViewController *)Easy_viewCurrentViewController; 31 | 32 | /** 33 | * addSubview之后的回调 34 | */ 35 | @property (nonatomic, copy) void(^Easy_didAddsubView)(UIView *view); 36 | 37 | /** 38 | * 为视图添加一个事件 39 | */ 40 | - (void)Easy_addTapCallBack:(id)target sel:(SEL)selector; 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 chenliangloveyou 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 | -------------------------------------------------------------------------------- /EasyNavigationDemoTests/EasyNavigationDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationDemoTests.m 3 | // EasyNavigationDemoTests 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyNavigationDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation EasyNavigationDemoTests 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 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavEmptyViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavEmptyViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavEmptyViewController.h" 10 | 11 | @interface NavEmptyViewController () 12 | 13 | @end 14 | 15 | @implementation NavEmptyViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | #if 1//以下两个2选1 21 | if (self.navigationView) { 22 | [self.navigationView removeFromSuperview]; 23 | } 24 | #else 25 | self.navigationView.hidden = YES ; 26 | #endif 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | /* 35 | #pragma mark - Navigation 36 | 37 | // In a storyboard-based application, you will often want to do a little preparation before navigation 38 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 39 | // Get the new view controller using [segue destinationViewController]. 40 | // Pass the selected object to the new view controller. 41 | } 42 | */ 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationScroll.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationScroll.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/7/1. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationScroll.h" 10 | 11 | @implementation EasyNavigationScroll 12 | 13 | + (instancetype)scroll 14 | { 15 | return self.new ; 16 | } 17 | 18 | - (EasyNavigationScroll *(^)(EasyNavScrollType))setScrollType 19 | { 20 | return ^EasyNavigationScroll *(EasyNavScrollType type){ 21 | self.scrollType = type ; 22 | return self; 23 | }; 24 | } 25 | - (EasyNavigationScroll *(^)(BOOL))setIsStopSatusBar 26 | { 27 | return ^EasyNavigationScroll *(BOOL isStop){ 28 | self.isStopSatusBar = isStop ; 29 | return self; 30 | }; 31 | } 32 | - (EasyNavigationScroll *(^)(float))setStartPoint 33 | { 34 | return ^EasyNavigationScroll *(float point){ 35 | self.startPoint = point ; 36 | return self; 37 | }; 38 | } 39 | - (EasyNavigationScroll *(^)(float))setStopPoint 40 | { 41 | return ^EasyNavigationScroll *(float point){ 42 | self.stopPoint = point ; 43 | return self; 44 | }; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavSmoothHidenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavSmoothHidenViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavSmoothHidenViewController.h" 10 | 11 | @interface NavSmoothHidenViewController () 12 | 13 | @end 14 | 15 | @implementation NavSmoothHidenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | [self.navigationView setTitle:@"导航条滚动隐藏"]; 21 | 22 | [self.navigationView navigationSmoothScroll:self.tableView start:NavigationHeight_N() speed:0.5f stopToStatusBar:NO]; 23 | 24 | } 25 | 26 | - (void)didReceiveMemoryWarning { 27 | [super didReceiveMemoryWarning]; 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | /* 32 | #pragma mark - Navigation 33 | 34 | // In a storyboard-based application, you will often want to do a little preparation before navigation 35 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 36 | // Get the new view controller using [segue destinationViewController]. 37 | // Pass the selected object to the new view controller. 38 | } 39 | */ 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavSmoothHiden_1_ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavSmoothHiden_1_ViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavSmoothHiden_1_ViewController.h" 10 | 11 | @interface NavSmoothHiden_1_ViewController () 12 | 13 | @end 14 | 15 | @implementation NavSmoothHiden_1_ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | 21 | [self.navigationView setTitle:@"导航条滚动隐藏(statusBar下停止)"]; 22 | 23 | [self.navigationView navigationSmoothScroll:self.tableView start:NavigationHeight_N() speed:0.5 stopToStatusBar:YES]; 24 | 25 | } 26 | 27 | - (void)didReceiveMemoryWarning { 28 | [super didReceiveMemoryWarning]; 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | /* 33 | #pragma mark - Navigation 34 | 35 | // In a storyboard-based application, you will often want to do a little preparation before navigation 36 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 37 | // Get the new view controller using [segue destinationViewController]. 38 | // Pass the selected object to the new view controller. 39 | } 40 | */ 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavAnimationHidenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavAnimationHidenViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavAnimationHidenViewController.h" 10 | 11 | @interface NavAnimationHidenViewController () 12 | 13 | @end 14 | 15 | @implementation NavAnimationHidenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | [self.navigationView setTitle:@"导航条动画隐藏"]; 21 | 22 | [self.navigationView navigationAnimationScroll:self.tableView criticalPoint:NavigationHeight_N() stopToStatusBar:NO]; 23 | 24 | // Do any additional setup after loading the view. 25 | } 26 | 27 | - (void)didReceiveMemoryWarning { 28 | [super didReceiveMemoryWarning]; 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | /* 33 | #pragma mark - Navigation 34 | 35 | // In a storyboard-based application, you will often want to do a little preparation before navigation 36 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 37 | // Get the new view controller using [segue destinationViewController]. 38 | // Pass the selected object to the new view controller. 39 | } 40 | */ 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationScroll.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationScroll.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/7/1. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | /** 14 | * 导航条改变的类型 15 | */ 16 | typedef NS_ENUM(NSUInteger , EasyNavScrollType) { 17 | EasyNavScrollTypeUnKnow , 18 | EasyNavScrollTypeAlphaChange , //alpha改变 19 | EasyNavScrollTypeSmooth , //跟着scrollview慢慢平滑滚动 20 | EasyNavScrollTypeAnimation , //到达一个点后 突然一个动画滑上去,滑下来 21 | }; 22 | 23 | 24 | @interface EasyNavigationScroll : NSObject 25 | 26 | // 27 | @property (nonatomic,assign)EasyNavScrollType scrollType ;//导航条滚动类型 28 | 29 | @property (nonatomic,assign)BOOL isStopSatusBar ;//是否在statusBar下面停止 30 | 31 | @property (nonatomic,assign)float startPoint ;//为触发导航条隐藏的点。也就是当scrollview的contentOffset.y值操作这个数的时候,导航条就会隐藏 32 | 33 | @property (nonatomic,assign)float stopPoint ;//停止变化的点。 34 | 35 | + (instancetype)scroll ; 36 | 37 | - (EasyNavigationScroll *(^)(EasyNavScrollType))setScrollType ; 38 | - (EasyNavigationScroll *(^)(BOOL))setIsStopSatusBar ; 39 | - (EasyNavigationScroll *(^)(float))setStartPoint ; 40 | - (EasyNavigationScroll *(^)(float))setStopPoint ; 41 | 42 | @end 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /EasyNavigationDemoUITests/EasyNavigationDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationDemoUITests.m 3 | // EasyNavigationDemoUITests 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyNavigationDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation EasyNavigationDemoUITests 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 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavButtonConfig.h 3 | // EFDoctorHealth 4 | // 5 | // Created by nf on 2017/12/28. 6 | // Copyright © 2017年 NF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyNavigationButton : UIButton 12 | 13 | @property (nonatomic,strong)NSString * title ; 14 | @property (nonatomic,strong)UIColor * titleColor ; 15 | @property (nonatomic,strong)UIColor * titleSelectColor ; 16 | @property (nonatomic,strong)UIFont * titleFont ; 17 | 18 | @property (nonatomic,strong)NSString * imageName ; 19 | @property (nonatomic,strong)NSString * highImageName ; 20 | @property (nonatomic,strong)NSString * backgroundImageName ; 21 | 22 | @property (nonatomic,assign)CGRect titleFrame ;//注意:一定是相对于button内部的 23 | @property (nonatomic,assign)CGRect imageFrame ;//注意:一定是相对于button内部的 24 | 25 | 26 | - (EasyNavigationButton *(^)(NSString *))setTitle ; 27 | - (EasyNavigationButton *(^)(UIColor *))setTitleColor ; 28 | - (EasyNavigationButton *(^)(UIColor *))setTitleSelectColor ; 29 | - (EasyNavigationButton *(^)(UIFont *))setTitleFont ; 30 | 31 | - (EasyNavigationButton *(^)(NSString *))setImageName ; 32 | - (EasyNavigationButton *(^)(NSString *))setHighImageName ; 33 | - (EasyNavigationButton *(^)(NSString *))setBackgroundImageName ; 34 | 35 | - (EasyNavigationButton *(^)(CGRect))setTitleFrame ; 36 | - (EasyNavigationButton *(^)(CGRect))setImageFrame; 37 | 38 | 39 | + (instancetype)button ; 40 | 41 | + (instancetype)buttonWithConfig:(EasyNavigationButton *(^)(void))button ; 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Hidden/NavAnimationHiden_1_ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavAnimationHiden_1_ViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavAnimationHiden_1_ViewController.h" 10 | 11 | @interface NavAnimationHiden_1_ViewController () 12 | 13 | @end 14 | 15 | @implementation NavAnimationHiden_1_ViewController 16 | - (void)dealloc 17 | { 18 | NSLog(@"navigationview : %@",self.navigationView); 19 | } 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | [self.navigationView setTitle:@"导航条动画隐藏(statusBar下停止)"]; 24 | 25 | [self.navigationView navigationAnimationScroll:self.tableView criticalPoint:NavigationHeight_N() stopToStatusBar:YES]; 26 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]; 27 | kWeakSelf(self) 28 | [self.navigationView addLeftButtonWithTitle:@"更多" clickCallBack:^(UIView *view) { 29 | [weakself.navigationView setTitle:@"点击了更多"]; 30 | }]; 31 | [self.navigationView addRightButtonWithTitle:@"添加按钮" clickCallBack:nil]; 32 | } 33 | 34 | /* 35 | #pragma mark - Navigation 36 | 37 | // In a storyboard-based application, you will often want to do a little preparation before navigation 38 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 39 | // Get the new view controller using [segue destinationViewController]. 40 | // Pass the selected object to the new view controller. 41 | } 42 | */ 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Alpha/NavAlphaChangeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavAlphaChangeViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavAlphaChangeViewController.h" 10 | 11 | @interface NavAlphaChangeViewController () 12 | 13 | @end 14 | 15 | @implementation NavAlphaChangeViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | [self.navigationView setTitle:@"导航条颜色渐变"]; 21 | self.tableView.contentInset = UIEdgeInsetsMake(-StatusBarHeight_N(), 0, 0, 0); 22 | 23 | // [self.navigationView setNavigationBackgroundAlpha:0.0]; 24 | 25 | #if 1//以下两个2选1 26 | [self.navigationView navigationAlphaSlowChangeWithScrollow:self.tableView]; 27 | #else 28 | [self.navigationView navigationAlphaSlowChangeWithScrollow:self.tableView start:NAV_HEIGHT end:NAV_HEIGHT*4]; 29 | #endif 30 | 31 | // Do any additional setup after loading the view. 32 | } 33 | 34 | - (void)didReceiveMemoryWarning { 35 | [super didReceiveMemoryWarning]; 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | /* 40 | #pragma mark - Navigation 41 | 42 | // In a storyboard-based application, you will often want to do a little preparation before navigation 43 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 44 | // Get the new view controller using [segue destinationViewController]. 45 | // Pass the selected object to the new view controller. 46 | } 47 | */ 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationView+Scroll.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+Scroll.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/5/29. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView.h" 10 | 11 | @interface EasyNavigationView (Scroll) 12 | 13 | /** 14 | * 导航条的alpha跟随 scrollview 的滚动而改变。 15 | * 16 | * startPoint/endPoint alpha 开始/停止 改变alpha的坐标。 中间会根据这个end-start区间均匀变化。 17 | */ 18 | - (void)navigationAlphaSlowChangeWithScrollow:(UIScrollView *)scrollow ; 19 | 20 | - (void)navigationAlphaSlowChangeWithScrollow:(UIScrollView *)scrollow 21 | start:(CGFloat)startPoint 22 | end:(CGFloat)endPoint ; 23 | 24 | /** 25 | * 导航条随scrollview滚动而慢慢隐藏 26 | * 27 | * scrollow 为支持导航条渐变的scrollview, 28 | * startPoint 开始渐变scrollow需要滚动的距离,也就是说,只有在self.tableView滚动NAV_HEIGHT后导航条才开始移动。 29 | * speed 它的值为:导航条滚动距离/scrollow滚动距离 30 | * stopStatusBar 到了状态栏下面的时候是否需要停止 31 | */ 32 | - (void)navigationSmoothScroll:(UIScrollView *)scrollow 33 | start:(CGFloat)startPoint 34 | speed:(CGFloat)speed 35 | stopToStatusBar:(BOOL)stopStatusBar ; 36 | 37 | /** 38 | * 超过临界点用一个UIview动画来 隐藏/显示 导航栏 39 | * 40 | * scrollow 为支持导航条渐变的scrollview 41 | * criticalPoint 为触发导航条隐藏的点。也就是当scrollview的contentOffset.y值操作这个数的时候,导航条就会隐藏 42 | * stopStatusBar 停止到startBar下面 43 | */ 44 | - (void)navigationAnimationScroll:(UIScrollView *)scrollow 45 | criticalPoint:(CGFloat)criticalPoint 46 | stopToStatusBar:(BOOL)stopStatusBar ; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavSystemSlidingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavSystemSlidingViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/15. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavSystemSlidingViewController.h" 10 | 11 | #import "EasyNavigation.h" 12 | 13 | @interface NavSystemSlidingViewController () 14 | @property (weak, nonatomic) IBOutlet UILabel *alertLabel; 15 | @property (weak, nonatomic) IBOutlet UISwitch *changeSwitch; 16 | 17 | @end 18 | 19 | @implementation NavSystemSlidingViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | [self.navigationView setTitle:@"系统返回手势"]; 25 | // Do any additional setup after loading the view from its nib. 26 | } 27 | - (void)viewDidAppear:(BOOL)animated 28 | { 29 | [super viewDidAppear:animated] ; 30 | } 31 | - (IBAction)changeSwitchClick:(id)sender { 32 | 33 | UISwitch *cSwitch = (UISwitch *)sender; 34 | 35 | self.disableSlidingBackGesture = !cSwitch.isOn ; 36 | self.alertLabel.text = cSwitch.isOn ? @"侧滑返回已打开":@"侧滑返回已关闭"; 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | /* 45 | #pragma mark - Navigation 46 | 47 | // In a storyboard-based application, you will often want to do a little preparation before navigation 48 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 49 | // Get the new view controller using [segue destinationViewController]. 50 | // Pass the selected object to the new view controller. 51 | } 52 | */ 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /EasyNavigationDemo/StatusBar/NavStatusBarViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavStatusBarViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavStatusBarViewController.h" 10 | 11 | #import "EasyNavigation.h" 12 | 13 | 14 | @interface NavStatusBarViewController () 15 | 16 | 17 | 18 | @end 19 | 20 | @implementation NavStatusBarViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | [self.navigationView setTitle:@"statusBar状态改变"]; 26 | // Do any additional setup after loading the view from its nib. 27 | } 28 | 29 | - (IBAction)statusBarSwitchClick:(id)sender { 30 | UISwitch *barSwitch = (UISwitch *)sender ; 31 | self.statusBarHidden = !barSwitch.isOn ; 32 | } 33 | - (IBAction)statusBarStyleSwitchClick:(id)sender { 34 | 35 | UISwitch *barSwitch = (UISwitch *)sender ; 36 | self.statusBarStyle = barSwitch.isOn ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent ; 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | // 45 | - (BOOL)prefersStatusBarHidden 46 | { 47 | return self.statusBarHidden; 48 | } 49 | 50 | /* 51 | #pragma mark - Navigation 52 | 53 | // In a storyboard-based application, you will often want to do a little preparation before navigation 54 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 55 | // Get the new view controller using [segue destinationViewController]. 56 | // Pass the selected object to the new view controller. 57 | } 58 | */ 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavButton.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | StringsTable 6 | Root 7 | PreferenceSpecifiers 8 | 9 | 10 | Type 11 | PSGroupSpecifier 12 | Title 13 | Group 14 | 15 | 16 | Type 17 | PSTextFieldSpecifier 18 | Title 19 | Name 20 | Key 21 | name_preference 22 | DefaultValue 23 | 24 | IsSecure 25 | 26 | KeyboardType 27 | Alphabet 28 | AutocapitalizationType 29 | None 30 | AutocorrectionType 31 | No 32 | 33 | 34 | Type 35 | PSToggleSwitchSpecifier 36 | Title 37 | Enabled 38 | Key 39 | enabled_preference 40 | DefaultValue 41 | 42 | 43 | 44 | Type 45 | PSSliderSpecifier 46 | Key 47 | slider_preference 48 | DefaultValue 49 | 0.5 50 | MinimumValue 51 | 0 52 | MaximumValue 53 | 1 54 | MinimumValueImage 55 | 56 | MaximumValueImage 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavScrollIncludeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavScrollIncludeViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavScrollIncludeViewController.h" 10 | #import "EasyNavigation.h" 11 | 12 | @interface NavScrollIncludeViewController () 13 | 14 | @end 15 | 16 | @implementation NavScrollIncludeViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | [self.navigationView setTitle:@"嵌套scrollview返回"]; 22 | 23 | UIScrollView *scrollview = [[UIScrollView alloc]initWithFrame:self.view.bounds]; 24 | scrollview.contentSize = CGSizeMake(self.view.Easy_width*3, 0) ; 25 | scrollview.pagingEnabled = YES ; 26 | [self.view addSubview:scrollview]; 27 | self.navigationView.navigationBackButtonCallback = ^(UIView *view) { 28 | NSLog(@"kkk"); 29 | }; 30 | 31 | for (int i = 0; i < 3; i++) { 32 | UIView *view = [[UIView alloc]initWithFrame:CGRectMake( scrollview.Easy_width*i, 0, scrollview.Easy_width, scrollview.Easy_height)]; 33 | view.backgroundColor = kColorRandom_N ; 34 | [scrollview addSubview:view]; 35 | 36 | } 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | /* 45 | #pragma mark - Navigation 46 | 47 | // In a storyboard-based application, you will often want to do a little preparation before navigation 48 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 49 | // Get the new view controller using [segue destinationViewController]. 50 | // Pass the selected object to the new view controller. 51 | } 52 | */ 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UIStatusBarStyle 34 | UIStatusBarStyleBlackOpaque 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIViewControllerBasedStatusBarAppearance 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationView+Add.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+AddView.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/6/29. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView.h" 10 | 11 | @interface EasyNavigationView (Add) 12 | 13 | 14 | #pragma mark - 添加一个单纯的view,不会布局该控件 15 | 16 | //其实和 addsubview:相比 就多了一个 callback的点击回调方法。 17 | - (void)addSubview:(UIView *)view callback:(clickCallback)callback ; 18 | 19 | 20 | #pragma mark - 添加一个titleview,和titlelabel互斥,永远只会有一个存在 21 | 22 | //中间视图永远只有一个,并且和leftbutton,rightbutton会有为位置的排列。 23 | - (void)addTitleView:(UIView *)titleView ; 24 | - (void)addTitleView:(UIView *)titleView callback:(clickCallback)callback ; 25 | 26 | 27 | #pragma mark - 往左边添加一个button或者view 28 | 29 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 30 | callback:(clickCallback)callback ; 31 | 32 | - (UIButton *)addLeftButtonWithImageName:(NSString *)imageName 33 | callback:(clickCallback)callback ; 34 | 35 | - (UIButton *)addLeftButton:(EasyNavigationButton *(^)(void))button 36 | callback:(clickCallback)callback ; 37 | 38 | - (void)addLeftView:(UIView *)view 39 | callback:(clickCallback)callback ; 40 | 41 | 42 | #pragma mark - 往又边添加一个button或者view 43 | 44 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 45 | callback:(clickCallback)callback ; 46 | 47 | - (UIButton *)addRightButtonWithImageName:(NSString *)imageName 48 | callback:(clickCallback)callback ; 49 | 50 | - (UIButton *)addRightButton:(EasyNavigationButton *(^)(void))button 51 | callback:(clickCallback)callback ; 52 | 53 | - (void)addRightView:(UIView *)view 54 | callback:(clickCallback)callback ; 55 | 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavCustomSlidingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavCustomSlidingViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/15. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavCustomSlidingViewController.h" 10 | 11 | #import "EasyNavigation.h" 12 | 13 | @interface NavCustomSlidingViewController () 14 | 15 | @property (weak, nonatomic) IBOutlet UITextField *textField; 16 | @end 17 | 18 | @implementation NavCustomSlidingViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | [self.navigationView setTitle:@"自定义手势返回"]; 24 | 25 | self.textField.delegate = self ; 26 | 27 | self.customBackGestureEnabel = YES ; 28 | 29 | __weak typeof(self) weakself = self ; 30 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 31 | weakself.textField.text = @"100" ; 32 | [weakself.textField becomeFirstResponder]; 33 | }); 34 | // Do any additional setup after loading the view from its nib. 35 | } 36 | 37 | - (BOOL)textFieldShouldReturn:(UITextField *)textField 38 | { 39 | self.customBackGestureEdge = textField.text.floatValue ; 40 | [textField resignFirstResponder]; 41 | return YES ; 42 | } 43 | - (void)didReceiveMemoryWarning { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | /* 49 | #pragma mark - Navigation 50 | 51 | // In a storyboard-based application, you will often want to do a little preparation before navigation 52 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 53 | // Get the new view controller using [segue destinationViewController]. 54 | // Pass the selected object to the new view controller. 55 | } 56 | */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /EasyNavigationDemo/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 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Alpha/NavTransparentViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavTransparentViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavTransparentViewController.h" 10 | 11 | @interface NavTransparentViewController () 12 | 13 | @end 14 | 15 | @implementation NavTransparentViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | self.tableView.contentInset = UIEdgeInsetsMake(-StatusBarHeight_N(), 0, 0, 0); 21 | 22 | [self.navigationView setTitle:@"透明导航条"]; 23 | [self.navigationView setNavigationBackgroundAlpha:0]; 24 | self.navigationView.lineView.alpha = 1 ; 25 | } 26 | 27 | 28 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 29 | { 30 | 31 | UIImage *btnImage = nil ; 32 | if (scrollView.contentOffset.y > 100){ 33 | btnImage = [UIImage imageNamed:@"nav_btn_back_blue.png"] ; 34 | self.navigationView.titleLabel.textColor = [UIColor cyanColor]; 35 | } 36 | else{ 37 | btnImage = [UIImage imageNamed:@"nav_btn_back.png"] ; 38 | self.navigationView.titleLabel.textColor = [UIColor whiteColor]; 39 | } 40 | 41 | [self.navigationView.navigationBackButton setImage:btnImage forState:UIControlStateNormal]; 42 | } 43 | - (void)didReceiveMemoryWarning { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | /* 49 | #pragma mark - Navigation 50 | 51 | // In a storyboard-based application, you will often want to do a little preparation before navigation 52 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 53 | // Get the new view controller using [segue destinationViewController]. 54 | // Pass the selected object to the new view controller. 55 | } 56 | */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UIViewController+EasyNavigationExt.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+EasyNavigationExt.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/7. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @class EasyNavigationController ; 13 | 14 | #import "EasyNavigationView.h" 15 | #import "EasyNavigationUtils.h" 16 | 17 | @interface UIViewController (EasyNavigationExt) 18 | 19 | /** 20 | * 当前的导航条 21 | */ 22 | @property (nonatomic,strong)EasyNavigationView *navigationView ; 23 | 24 | /** 25 | * 当前控制器 是否 禁止侧滑返回 26 | */ 27 | @property (nonatomic,assign)BOOL disableSlidingBackGesture ; 28 | 29 | /** 30 | * 是否开始 手势侧滑返回 31 | */ 32 | @property (nonatomic,assign)BOOL customBackGestureEnabel ; 33 | 34 | /** 35 | * 如果开启了手势侧滑,那么侧滑距离左边最大的距离 36 | */ 37 | @property (nonatomic,assign)CGFloat customBackGestureEdge ; 38 | 39 | /** 40 | * 当前控制器状态栏类型 41 | */ 42 | @property (nonatomic,assign)UIStatusBarStyle statusBarStyle; 43 | 44 | /** 45 | * 当前控制器的状态栏是否隐藏 46 | */ 47 | @property (nonatomic,assign)BOOL statusBarHidden ; 48 | 49 | 50 | /** 51 | * 处理侧滑返回手势 52 | */ 53 | - (void)dealSlidingGestureDelegate ; 54 | 55 | 56 | ///** 57 | // * 横屏的时候是否显示状态栏 (默认为不显示) 58 | // */ 59 | //@property (nonatomic,assign)BOOL horizontalScreenShowStatusBar ; 60 | 61 | /** 62 | * 当前的导航控制器 63 | */ 64 | //@property (nonatomic, weak) EasyNavigationController *vcEasyNavController ; 65 | 66 | /** 67 | * 导航栏初始高度(刚初始化页面,没有对导航条操作是的高度) 注意与导航条(self.navigationView.height)的区别。 68 | * 69 | * 竖屏:statusBar的高度 + 正常高度 + 大标题高度(如果显示) 70 | * 横屏:statusBar的高度(如果显示) + 正常高度 71 | */ 72 | //@property (nonatomic,assign,readonly)CGFloat navigationHeight ; 73 | /** 74 | * 是否正在展示大标题 75 | */ 76 | //@property (nonatomic,assign,readonly)BOOL isShowBigTitle ; 77 | 78 | 79 | /** 80 | * 当前控制器大标题类型 81 | */ 82 | //@property (assign)NavBigTitleType navbigTitleType ; 83 | /** 84 | * 当前控制器大标题移动动画类型 85 | */ 86 | //@property (assign)NavTitleAnimationType navTitleAnimationType ; 87 | 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /EasyNavigationDemo/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 | } -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavigationView+LeftButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+LeftButton.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/30. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView.h" 10 | 11 | @interface EasyNavigationView (LeftButton) 12 | 13 | 14 | /** 15 | * 往左边视图上加一个view。调用此方法把view加到视图的左边,将会和创建的按钮一同计算排列位置 16 | * view 需要添加到左视图的控件 17 | */ 18 | - (void)addLeftView:(UIView *)view 19 | clickCallback:(clickCallback)callback ; 20 | 21 | /** 22 | * 创建一个按钮并放到导航条的左边。会按照添加顺序,一个一个排列 23 | * title 按钮上的文字 24 | * image 按钮上的图片 25 | * hightImage 按钮按下(高亮)时的图片 26 | * backgroundImage 按钮的背景图片 27 | * callback 按钮的点击回调事件 28 | * return 创建的按钮指针,可以继续用来操作按钮 29 | */ 30 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 31 | clickCallBack:(clickCallback)callback ; 32 | 33 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 34 | image:(UIImage *)image 35 | clickCallBack:(clickCallback)callback ; 36 | 37 | - (UIButton *)addLeftButtonWithImage:(UIImage *)image 38 | clickCallBack:(clickCallback)callback ; 39 | 40 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 41 | backgroundImage:(UIImage *)backgroundImage 42 | clickCallBack:(clickCallback)callback ; 43 | 44 | 45 | - (UIButton *)addLeftButtonWithImage:(UIImage *)image 46 | hightImage:(UIImage *)hightImage 47 | clickCallBack:(clickCallback)callback ; 48 | 49 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 50 | image:(UIImage *)image 51 | hightImage:(UIImage *)hightImage 52 | backgroundImage:(UIImage *)backgroundImage 53 | clickCallBack:(clickCallback)callback ; 54 | 55 | /** 56 | * 从左边视图移除掉一个视图 57 | */ 58 | - (void)removeLeftView:(UIView *)view ; 59 | 60 | /** 61 | * 左边所有的视图全部移除 62 | */ 63 | //- (void)removeAllLeftButton ; 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavigationView+RightButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+RightButton.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/30. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView.h" 10 | 11 | @interface EasyNavigationView (RightButton) 12 | 13 | 14 | /** 15 | * 往右边视图上加一个view。调用此方法把view加到视图的右边,将会和创建的按钮一同计算排列位置 16 | * view 需要添加到右视图的控件 17 | */ 18 | - (void)addRightView:(UIView *)view 19 | clickCallback:(clickCallback)callback ; 20 | 21 | /** 22 | * 创建一个按钮并放到导航条的右边。会按照添加顺序,一个一个排列 23 | * title 按钮上的文字 24 | * image 按钮上的图片 25 | * hightImage 按钮按下(高亮)时的图片 26 | * backgroundImage 按钮的背景图片 27 | * callback 按钮的点击回调事件 28 | * return 创建的按钮指针,可以继续用来操作按钮 29 | */ 30 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 31 | clickCallBack:(clickCallback)callback ; 32 | 33 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 34 | image:(UIImage *)image 35 | clickCallBack:(clickCallback)callback ; 36 | 37 | - (UIButton *)addRightButtonWithImage:(UIImage *)image 38 | clickCallBack:(clickCallback)callback ; 39 | 40 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 41 | backgroundImage:(UIImage *)backgroundImage 42 | clickCallBack:(clickCallback)callback ; 43 | 44 | 45 | - (UIButton *)addRightButtonWithImage:(UIImage *)image 46 | hightImage:(UIImage *)hightImage 47 | clickCallBack:(clickCallback)callback ; 48 | 49 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 50 | image:(UIImage *)image 51 | hightImage:(UIImage *)hightImage 52 | backgroundImage:(UIImage *)backgroundImage 53 | clickCallBack:(clickCallback)callback ; 54 | 55 | /** 56 | * 从右边视图移除掉一个视图 57 | */ 58 | - (void)removeRightView:(UIView *)view ; 59 | 60 | /** 61 | * 右边所有的视图全部移除 62 | */ 63 | //- (void)removeAllRightButton ; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationView+Scroll.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+Scroll.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/5/29. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView+Scroll.h" 10 | //#import 11 | //#import "UIView+EasyNavigationExt.h" 12 | //#import "UIScrollView+EasyNavigationExt.h" 13 | 14 | @implementation EasyNavigationView (Scroll) 15 | 16 | /** 17 | * 根据scrollview的滚动,导航条慢慢渐变 18 | */ 19 | - (void)navigationAlphaSlowChangeWithScrollow:(UIScrollView *)scrollow 20 | { 21 | [self navigationAlphaSlowChangeWithScrollow:scrollow 22 | start:0 23 | end:100]; 24 | } 25 | - (void)navigationAlphaSlowChangeWithScrollow:(UIScrollView *)scrollow 26 | start:(CGFloat)startPoint 27 | end:(CGFloat)endPoint 28 | { 29 | [self navigationScrollWithScrollView:scrollow config:^EasyNavigationScroll *{ 30 | return [EasyNavigationScroll scroll] 31 | .setScrollType(EasyNavScrollTypeAlphaChange) 32 | .setStartPoint(startPoint) 33 | .setStopPoint(endPoint); 34 | }]; 35 | } 36 | /** 37 | * 根据scrollview滚动,导航条隐藏或者展示. 38 | */ 39 | - (void)navigationSmoothScroll:(UIScrollView *)scrollow 40 | start:(CGFloat)startPoint 41 | speed:(CGFloat)speed 42 | stopToStatusBar:(BOOL)stopstatusBar 43 | { 44 | [self navigationScrollWithScrollView:scrollow config:^EasyNavigationScroll *{ 45 | return [EasyNavigationScroll scroll] 46 | .setScrollType(EasyNavScrollTypeSmooth) 47 | .setStartPoint(startPoint) 48 | .setStopPoint(startPoint + startPoint*speed) 49 | .setIsStopSatusBar(stopstatusBar); 50 | }]; 51 | 52 | // self.kvoScrollView.scrollDistance = startPoint ; 53 | 54 | } 55 | 56 | - (void)navigationAnimationScroll:(UIScrollView *)scrollow 57 | criticalPoint:(CGFloat)criticalPoint 58 | stopToStatusBar:(BOOL)stopstatusBar 59 | { 60 | 61 | [self navigationScrollWithScrollView:scrollow config:^EasyNavigationScroll *{ 62 | return [EasyNavigationScroll scroll] 63 | .setScrollType(EasyNavScrollTypeAnimation) 64 | .setStartPoint(criticalPoint) 65 | .setIsStopSatusBar(stopstatusBar); 66 | }]; 67 | } 68 | 69 | @end 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationOptions.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationOptions.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/11. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import 12 | #import "EasyNavigationUtils.h" 13 | 14 | /** 15 | 返回按钮样式 16 | 17 | - FBackBtnTitleType_Default: 默认为返回图标,没有文字 18 | - FBackBtnTitleType_System: 系统样式,返回图标 + 上级页面标题 19 | */ 20 | typedef NS_ENUM(NSUInteger, FBackBtnTitleType) { 21 | FBackBtnTitleType_Default = 0, 22 | FBackBtnTitleType_System, 23 | 24 | }; 25 | 26 | 27 | @interface EasyNavigationOptions : NSObject 28 | 29 | /** 30 | * 导航条基本设置的单例,用来设置全局导航条属性。(当需要改变导航条属性时,需要对改变的导航条单独设置) 31 | * 只需在APPdelegate里面设置一次,全局适用。 32 | */ 33 | + (instancetype)shareInstance ; 34 | 35 | /** 36 | 设置返回按钮标题样式 37 | */ 38 | @property (nonatomic, assign) FBackBtnTitleType btnTitleType; 39 | 40 | 41 | /** 42 | * 导航条使用大标题类型(如果在单个控制器中没有设置类型,就是使用这里设置的类型) 43 | */ 44 | @property (assign)NavBigTitleType navbigTitleType ; 45 | /** 46 | * 导航条大标题移动动画类型 (有效前提:navbigTitleType不为NavBigTitleTypeDefault) 47 | */ 48 | @property (assign)NavTitleAnimationType navTitleAnimationType ; 49 | 50 | /** 51 | * 导航条的透明度 52 | */ 53 | @property (nonatomic,assign)CGFloat backGroundAlpha ; 54 | 55 | /** 56 | * 导航条的背景色 57 | */ 58 | @property (nonatomic,strong)UIColor *navBackGroundColor ; 59 | 60 | /** 61 | * 导航条细线下的颜色 62 | */ 63 | @property (nonatomic,strong)UIColor *navLineColor ; 64 | 65 | /** 66 | * 导航条的背景图片 67 | */ 68 | @property (nonatomic,strong)UIImage *navBackgroundImage ; 69 | 70 | 71 | /** 72 | * titleLabel 字体大小 73 | */ 74 | @property (nonatomic,strong)UIFont *titleFont ; 75 | /** 76 | * 大标题显示的字体 77 | */ 78 | @property (nonatomic,strong)UIFont *titleBigFount ; 79 | /** 80 | * titleLabel 字体颜色 81 | */ 82 | @property (nonatomic,strong)UIColor *titleColor ; 83 | 84 | 85 | /** 86 | * 左右两边按钮字体大小 87 | */ 88 | @property (nonatomic,strong)UIFont *buttonTitleFont ; 89 | 90 | /** 91 | * 按钮字体颜色 92 | */ 93 | @property (nonatomic,strong)UIColor *buttonTitleColor ; 94 | 95 | /** 96 | * 按钮高亮时的字体颜色 97 | */ 98 | @property (nonatomic,strong)UIColor *buttonTitleColorHieght ; 99 | 100 | /** 101 | * 系统返回按钮 图片/文字 更改 102 | */ 103 | @property (nonatomic,strong)NSString *navigationBackButtonImageName ; 104 | @property (nonatomic,strong)NSString *navigationBackButtonTitle ; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /EasyNavigationDemo/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | 12 | @interface BaseViewController () 13 | 14 | @property (nonatomic,strong)UITableView *tableView ; 15 | @end 16 | 17 | @implementation BaseViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.automaticallyAdjustsScrollViewInsets = NO ; 23 | 24 | // self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 25 | 26 | [self.view addSubview:self.tableView]; 27 | } 28 | 29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 30 | { 31 | return 40 ; 32 | } 33 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 34 | { 35 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath]; 36 | cell.accessoryType = UITableViewCellStyleValue1; 37 | cell.textLabel.text = [NSString stringWithFormat:@"第%zd个cell",indexPath.row+1]; 38 | return cell; 39 | } 40 | 41 | - (UITableView *)tableView 42 | { 43 | if (nil == _tableView) { 44 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; 45 | _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 46 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]; 47 | _tableView.dataSource = self ; 48 | _tableView.delegate = self ; 49 | 50 | UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 160)]; 51 | img.backgroundColor = [UIColor lightGrayColor]; 52 | _tableView.tableHeaderView =img ; 53 | } 54 | return _tableView ; 55 | } 56 | 57 | - (void)didReceiveMemoryWarning { 58 | [super didReceiveMemoryWarning]; 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | /* 63 | #pragma mark - Navigation 64 | 65 | // In a storyboard-based application, you will often want to do a little preparation before navigation 66 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 67 | // Get the new view controller using [segue destinationViewController]. 68 | // Pass the selected object to the new view controller. 69 | } 70 | */ 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Bugly.framework/Headers/BuglyLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // BuglyLog.h 3 | // Bugly 4 | // 5 | // Copyright (c) 2017年 Tencent. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | // Log level for Bugly Log 11 | typedef NS_ENUM(NSUInteger, BuglyLogLevel) { 12 | BuglyLogLevelSilent = 0, 13 | BuglyLogLevelError = 1, 14 | BuglyLogLevelWarn = 2, 15 | BuglyLogLevelInfo = 3, 16 | BuglyLogLevelDebug = 4, 17 | BuglyLogLevelVerbose = 5, 18 | }; 19 | #pragma mark - 20 | 21 | OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3); 22 | 23 | OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0); 24 | 25 | #pragma mark - 26 | #define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__] 27 | 28 | #define BLYLogError(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__) 29 | #define BLYLogWarn(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelWarn, fmt, ##__VA_ARGS__) 30 | #define BLYLogInfo(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__) 31 | #define BLYLogDebug(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__) 32 | #define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__) 33 | 34 | #pragma mark - Interface 35 | @interface BuglyLog : NSObject 36 | 37 | /** 38 | * @brief 初始化日志模块 39 | * 40 | * @param level 设置默认日志级别,默认BLYLogLevelSilent 41 | * 42 | * @param printConsole 是否打印到控制台,默认NO 43 | */ 44 | + (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole; 45 | 46 | /** 47 | * @brief 打印BLYLogLevelInfo日志 48 | * 49 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 50 | */ 51 | + (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2); 52 | 53 | /** 54 | * @brief 打印日志 55 | * 56 | * @param level 日志级别 57 | * @param message 日志内容 总日志大小限制为:字符串长度30k,条数200 58 | */ 59 | + (void)level:(BuglyLogLevel) level logs:(NSString *)message; 60 | 61 | /** 62 | * @brief 打印日志 63 | * 64 | * @param level 日志级别 65 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 66 | */ 67 | + (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3); 68 | 69 | /** 70 | * @brief 打印日志 71 | * 72 | * @param level 日志级别 73 | * @param tag 日志模块分类 74 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 75 | */ 76 | + (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4); 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UIScrollView+EasyNavigationExt.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+EasyNavigationExt.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/13. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "UIScrollView+EasyNavigationExt.h" 10 | #import 11 | 12 | 13 | @implementation UIScrollView (EasyNavigationExt) 14 | 15 | //- (void)dealloc 16 | //{ 17 | //} 18 | 19 | - (EasyScrollDirection)Easy_direction{ 20 | 21 | NSNumber *tempDirection = objc_getAssociatedObject(self, _cmd); 22 | return tempDirection.integerValue ; 23 | } 24 | - (void)setEasy_direction:(EasyScrollDirection)Easy_direction{ 25 | 26 | objc_setAssociatedObject(self, @selector(Easy_direction), @(Easy_direction), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 27 | } 28 | 29 | - (float)Easy_scrollDistance{ 30 | 31 | NSNumber *tempDistance = objc_getAssociatedObject(self, _cmd); 32 | return tempDistance.floatValue ; 33 | } 34 | - (void)setEasy_scrollDistance:(float)Easy_scrollDistance{ 35 | 36 | objc_setAssociatedObject(self, @selector(Easy_scrollDistance), @(Easy_scrollDistance), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 37 | } 38 | - (void)setEasy_enableDirection:(BOOL)Easy_enableDirection{ 39 | 40 | objc_setAssociatedObject(self, @selector(Easy_enableDirection), @(Easy_enableDirection), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 41 | } 42 | - (BOOL)Easy_enableDirection{ 43 | 44 | NSNumber * number = objc_getAssociatedObject(self, _cmd); 45 | return number.integerValue; 46 | } 47 | 48 | 49 | 50 | //是否产生一个新的touch对象来响应手势 51 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch 52 | { 53 | return YES; 54 | } 55 | 56 | 57 | // 当scrollview上产生一个手势 是否相应事件 58 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer 59 | { 60 | if (gestureRecognizer == self.panGestureRecognizer) { 61 | 62 | CGPoint point = [self.panGestureRecognizer translationInView:self]; 63 | 64 | UIGestureRecognizerState state = gestureRecognizer.state; 65 | 66 | CGFloat locationDistance = [UIScreen mainScreen].bounds.size.width; 67 | 68 | if (state == UIGestureRecognizerStateBegan || state == UIGestureRecognizerStatePossible) { 69 | CGPoint location = [gestureRecognizer locationInView:self]; 70 | if (point.x > 0 && location.x < locationDistance && self.contentOffset.x <= 0) { 71 | return NO; 72 | } 73 | } 74 | } 75 | return YES; 76 | 77 | } 78 | 79 | @end 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationUtils.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/7. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationUtils.h" 10 | 11 | @implementation EasyNavigationUtils 12 | 13 | #pragma mark - 根据颜色创建图片 14 | + (UIImage *)createImageWithColor:(UIColor *)color 15 | { 16 | CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 17 | UIGraphicsBeginImageContext(rect.size); 18 | CGContextRef context = UIGraphicsGetCurrentContext(); 19 | CGContextSetFillColorWithColor(context, [color CGColor]); 20 | CGContextFillRect(context, rect); 21 | UIImage*theImage = UIGraphicsGetImageFromCurrentImageContext(); 22 | UIGraphicsEndImageContext(); 23 | return theImage; 24 | } 25 | 26 | #pragma mark - 改变图片的颜色 27 | + (UIImage *) imageWithTintColor:(UIImage *)image color:(UIColor *)tintColor 28 | { 29 | UIGraphicsBeginImageContextWithOptions(image.size, NO, 0.0f); 30 | [tintColor setFill]; 31 | CGRect bounds = CGRectMake(0, 0, image.size.width, image.size.height); 32 | UIRectFill(bounds); 33 | 34 | [image drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f]; 35 | 36 | UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext(); 37 | UIGraphicsEndImageContext(); 38 | 39 | return tintedImage; 40 | } 41 | 42 | #pragma mark - 改变图片大小 43 | + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size 44 | { 45 | if([[UIScreen mainScreen] scale] == 2.0){ 46 | UIGraphicsBeginImageContextWithOptions(size, NO, 2.0); 47 | }else if([[UIScreen mainScreen] scale] == 3.0){ 48 | UIGraphicsBeginImageContextWithOptions(size, NO, 3.0); 49 | }else { 50 | UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸 51 | } 52 | 53 | // CGFloat x = (size.width - size.width*size)/2; 54 | // CGFloat y = (size.height - size.height*heightScale)/2; 55 | // [image drawInRect:CGRectMake(x, y, size.width*widthScale, size.height*heightScale)]; 56 | 57 | UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 58 | 59 | UIGraphicsEndImageContext(); 60 | 61 | return scaledImage; 62 | 63 | // // 并把它设置成为当前正在使用的context 64 | // UIGraphicsBeginImageContext(size); 65 | // // 绘制改变大小的图片 66 | // [img drawInRect:CGRectMake(0, 0, size.width, size.height)]; 67 | // // 从当前context中创建一个改变大小后的图片 68 | // UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 69 | // // 使当前的context出堆栈 70 | // UIGraphicsEndImageContext(); 71 | // // 返回新的改变大小后的图片 72 | // return scaledImage; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/Mr_Chen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 32 | 33 | 34 | 35 | 36 | 38 | 50 | 51 | 52 | 54 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Bugly.framework/Headers/BuglyConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // BuglyConfig.h 3 | // Bugly 4 | // 5 | // Copyright (c) 2016年 Tencent. All rights reserved. 6 | // 7 | 8 | #pragma once 9 | 10 | #define BLY_UNAVAILABLE(x) __attribute__((unavailable(x))) 11 | 12 | #if __has_feature(nullability) 13 | #define BLY_NONNULL __nonnull 14 | #define BLY_NULLABLE __nullable 15 | #define BLY_START_NONNULL _Pragma("clang assume_nonnull begin") 16 | #define BLY_END_NONNULL _Pragma("clang assume_nonnull end") 17 | #else 18 | #define BLY_NONNULL 19 | #define BLY_NULLABLE 20 | #define BLY_START_NONNULL 21 | #define BLY_END_NONNULL 22 | #endif 23 | 24 | #import 25 | 26 | #import "BuglyLog.h" 27 | 28 | BLY_START_NONNULL 29 | 30 | @protocol BuglyDelegate 31 | 32 | @optional 33 | /** 34 | * 发生异常时回调 35 | * 36 | * @param exception 异常信息 37 | * 38 | * @return 返回需上报记录,随异常上报一起上报 39 | */ 40 | - (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception; 41 | 42 | @end 43 | 44 | @interface BuglyConfig : NSObject 45 | 46 | /** 47 | * SDK Debug信息开关, 默认关闭 48 | */ 49 | @property (nonatomic, assign) BOOL debugMode; 50 | 51 | /** 52 | * 设置自定义渠道标识 53 | */ 54 | @property (nonatomic, copy) NSString *channel; 55 | 56 | /** 57 | * 设置自定义版本号 58 | */ 59 | @property (nonatomic, copy) NSString *version; 60 | 61 | /** 62 | * 设置自定义设备唯一标识 63 | */ 64 | @property (nonatomic, copy) NSString *deviceIdentifier; 65 | 66 | /** 67 | * 卡顿监控开关,默认关闭 68 | */ 69 | @property (nonatomic) BOOL blockMonitorEnable; 70 | 71 | /** 72 | * 卡顿监控判断间隔,单位为秒 73 | */ 74 | @property (nonatomic) NSTimeInterval blockMonitorTimeout; 75 | 76 | /** 77 | * 设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值) 78 | */ 79 | @property (nonatomic, copy) NSString *applicationGroupIdentifier; 80 | 81 | /** 82 | * 进程内还原开关,默认开启 83 | */ 84 | @property (nonatomic) BOOL symbolicateInProcessEnable; 85 | 86 | /** 87 | * 非正常退出事件记录开关,默认关闭 88 | */ 89 | @property (nonatomic) BOOL unexpectedTerminatingDetectionEnable; 90 | 91 | /** 92 | * 页面信息记录开关,默认开启 93 | */ 94 | @property (nonatomic) BOOL viewControllerTrackingEnable; 95 | 96 | /** 97 | * Bugly Delegate 98 | */ 99 | @property (nonatomic, assign) id delegate; 100 | 101 | /** 102 | * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。 103 | * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志 104 | */ 105 | @property (nonatomic, assign) BuglyLogLevel reportLogLevel; 106 | 107 | /** 108 | * 崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报 109 | * 例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等 110 | */ 111 | @property (nonatomic, copy) NSArray *excludeModuleFilter; 112 | 113 | /** 114 | * 控制台日志上报开关,默认开启 115 | */ 116 | @property (nonatomic, assign) BOOL consolelogEnable; 117 | 118 | /** 119 | * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出 120 | * 默认值 5s, 单位 秒 121 | * 当赋值为0时,则不会自动abort进程退出 122 | */ 123 | @property (nonatomic, assign) NSUInteger crashAbortTimeout; 124 | 125 | @end 126 | BLY_END_NONNULL 127 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationView+Add.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+AddView.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 2018/6/29. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView+Add.h" 10 | 11 | @implementation EasyNavigationView (Add) 12 | 13 | - (void)addSubview:(UIView *)view callback:(clickCallback)callback 14 | { 15 | [self addView:view clickCallback:callback type:NavigatioinViewPlaceTypeNone]; 16 | } 17 | 18 | - (void)addTitleView:(UIView *)titleView 19 | { 20 | [self addTitleView:titleView callback:nil]; 21 | } 22 | - (void)addTitleView:(UIView *)titleView callback:(clickCallback)callback 23 | { 24 | [self addView:titleView clickCallback:callback type:NavigatioinViewPlaceTypeCenter]; 25 | } 26 | 27 | 28 | #pragma mark - 左添加按钮 29 | 30 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 31 | callback:(clickCallback)callback 32 | { 33 | return [self addLeftButton:^EasyNavigationButton *{ 34 | return [EasyNavigationButton button].setTitle(title); 35 | } callback:callback] ; 36 | } 37 | - (UIButton *)addLeftButtonWithImageName:(NSString *)imageName 38 | callback:(clickCallback)callback 39 | { 40 | return [self addLeftButton:^EasyNavigationButton *{ 41 | return [EasyNavigationButton button].setImageName(imageName); 42 | } callback:callback] ; 43 | } 44 | 45 | - (UIButton *)addLeftButton:(EasyNavigationButton *(^)(void))button 46 | callback:(clickCallback)callback 47 | { 48 | EasyNavigationButton *btn = [EasyNavigationButton buttonWithConfig:button]; 49 | [self addLeftView:btn callback:callback]; 50 | return btn ; 51 | } 52 | 53 | - (void)addLeftView:(UIView *)view 54 | callback:(clickCallback)callback 55 | { 56 | [self addView:view clickCallback:callback type:NavigatioinViewPlaceTypeLeft]; 57 | } 58 | 59 | #pragma mark - 右边添加按钮 60 | 61 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 62 | callback:(clickCallback)callback 63 | { 64 | return [self addRightButton:^EasyNavigationButton *{ 65 | return [EasyNavigationButton button].setTitle(title); 66 | } callback:callback] ; 67 | } 68 | - (UIButton *)addRightButtonWithImageName:(NSString *)imageName 69 | callback:(clickCallback)callback 70 | { 71 | return [self addRightButton:^EasyNavigationButton *{ 72 | return [EasyNavigationButton button].setImageName(imageName); 73 | } callback:callback] ; 74 | } 75 | 76 | - (UIButton *)addRightButton:(EasyNavigationButton *(^)(void))button 77 | callback:(clickCallback)callback 78 | { 79 | EasyNavigationButton *btn = [EasyNavigationButton buttonWithConfig:button]; 80 | [self addRightView:btn callback:callback]; 81 | return btn ; 82 | } 83 | 84 | - (void)addRightView:(UIView *)view 85 | callback:(clickCallback)callback 86 | { 87 | [self addView:view clickCallback:callback type:NavigatioinViewPlaceTypeRight]; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavSystemSlidingViewController.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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/nf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 62 | 63 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Bugly.framework/Headers/Bugly.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bugly.h 3 | // 4 | // Version: 2.5(0) 5 | // 6 | // Copyright (c) 2017年 Tencent. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "BuglyConfig.h" 12 | #import "BuglyLog.h" 13 | 14 | BLY_START_NONNULL 15 | 16 | @interface Bugly : NSObject 17 | 18 | /** 19 | * 初始化Bugly,使用默认BuglyConfig 20 | * 21 | * @param appId 注册Bugly分配的应用唯一标识 22 | */ 23 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId; 24 | 25 | /** 26 | * 使用指定配置初始化Bugly 27 | * 28 | * @param appId 注册Bugly分配的应用唯一标识 29 | * @param config 传入配置的 BuglyConfig 30 | */ 31 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId 32 | config:(BuglyConfig * BLY_NULLABLE)config; 33 | 34 | /** 35 | * 使用指定配置初始化Bugly 36 | * 37 | * @param appId 注册Bugly分配的应用唯一标识 38 | * @param development 是否开发设备 39 | * @param config 传入配置的 BuglyConfig 40 | */ 41 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId 42 | developmentDevice:(BOOL)development 43 | config:(BuglyConfig * BLY_NULLABLE)config; 44 | 45 | /** 46 | * 设置用户标识 47 | * 48 | * @param userId 用户标识 49 | */ 50 | + (void)setUserIdentifier:(NSString *)userId; 51 | 52 | /** 53 | * 更新版本信息 54 | * 55 | * @param version 应用版本信息 56 | */ 57 | + (void)updateAppVersion:(NSString *)version; 58 | 59 | /** 60 | * 设置关键数据,随崩溃信息上报 61 | * 62 | * @param value KEY 63 | * @param key VALUE 64 | */ 65 | + (void)setUserValue:(NSString *)value 66 | forKey:(NSString *)key; 67 | 68 | /** 69 | * 获取关键数据 70 | * 71 | * @return 关键数据 72 | */ 73 | + (NSDictionary * BLY_NULLABLE)allUserValues; 74 | 75 | /** 76 | * 设置标签 77 | * 78 | * @param tag 标签ID,可在网站生成 79 | */ 80 | + (void)setTag:(NSUInteger)tag; 81 | 82 | /** 83 | * 获取当前设置标签 84 | * 85 | * @return 当前标签ID 86 | */ 87 | + (NSUInteger)currentTag; 88 | 89 | /** 90 | * 获取设备ID 91 | * 92 | * @return 设备ID 93 | */ 94 | + (NSString *)buglyDeviceId; 95 | 96 | /** 97 | * 上报自定义Objective-C异常 98 | * 99 | * @param exception 异常信息 100 | */ 101 | + (void)reportException:(NSException *)exception; 102 | 103 | /** 104 | * 上报错误 105 | * 106 | * @param error 错误信息 107 | */ 108 | + (void)reportError:(NSError *)error; 109 | 110 | /** 111 | * @brief 上报自定义错误 112 | * 113 | * @param category 类型(Cocoa=3,CSharp=4,JS=5,Lua=6) 114 | * @param aName 名称 115 | * @param aReason 错误原因 116 | * @param aStackArray 堆栈 117 | * @param info 附加数据 118 | * @param terminate 上报后是否退出应用进程 119 | */ 120 | + (void)reportExceptionWithCategory:(NSUInteger)category 121 | name:(NSString *)aName 122 | reason:(NSString *)aReason 123 | callStack:(NSArray *)aStackArray 124 | extraInfo:(NSDictionary *)info 125 | terminateApp:(BOOL)terminate; 126 | 127 | /** 128 | * SDK 版本信息 129 | * 130 | * @return SDK版本号 131 | */ 132 | + (NSString *)sdkVersion; 133 | 134 | /** 135 | * App 是否发生了连续闪退 136 | * 如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退 137 | * 138 | * @return 是否连续闪退 139 | */ 140 | + (BOOL)isAppCrashedOnStartUpExceedTheLimit; 141 | 142 | BLY_END_NONNULL 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /EasyNavigationDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | 12 | #import "EasyNavigation.h" 13 | 14 | #import "ViewController.h" 15 | 16 | @interface AppDelegate () 17 | 18 | @end 19 | 20 | @implementation AppDelegate 21 | 22 | 23 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 24 | 25 | EasyNavigationOptions *options = [EasyNavigationOptions shareInstance]; 26 | options.titleColor = [UIColor whiteColor]; 27 | options.buttonTitleFont = [UIFont systemFontOfSize:18]; 28 | options.navBackgroundImage = [UIImage imageNamed:@"nav_background_image.png"]; 29 | options.buttonTitleColor = [UIColor whiteColor]; 30 | 31 | // 设置系统返回按钮为样式 32 | // options.btnTitleType = FBackBtnTitleType_System; 33 | 34 | EasyNavigationController *navVC = [[EasyNavigationController alloc]initWithRootViewController:[ViewController new]]; 35 | self.window.rootViewController = navVC ; 36 | 37 | 38 | // Override point for customization after application launch. 39 | [self setupBugly]; 40 | return YES; 41 | } 42 | 43 | 44 | 45 | 46 | - (void)setupBugly { 47 | BuglyConfig * config = [[BuglyConfig alloc] init]; 48 | config.debugMode = YES; 49 | config.blockMonitorEnable = YES; 50 | config.blockMonitorTimeout = 1.5; 51 | config.viewControllerTrackingEnable = NO; 52 | config.consolelogEnable = NO ; 53 | [Bugly startWithAppId:@"bce1cf9ee3" 54 | developmentDevice:YES 55 | config:config]; 56 | 57 | [Bugly setUserIdentifier:[NSString stringWithFormat:@"User: %@", [UIDevice currentDevice].identifierForVendor]]; 58 | } 59 | 60 | - (void)applicationWillResignActive:(UIApplication *)application { 61 | // 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. 62 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 63 | } 64 | 65 | 66 | - (void)applicationDidEnterBackground:(UIApplication *)application { 67 | // 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. 68 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 69 | } 70 | 71 | 72 | - (void)applicationWillEnterForeground:(UIApplication *)application { 73 | // 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. 74 | } 75 | 76 | 77 | - (void)applicationDidBecomeActive:(UIApplication *)application { 78 | // 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. 79 | } 80 | 81 | 82 | - (void)applicationWillTerminate:(UIApplication *)application { 83 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 84 | } 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/7. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyNavigationOptions.h" 12 | #import "EasyNavigationButton.h" 13 | #import "EasyNavigationScroll.h" 14 | 15 | typedef void (^clickCallback)(UIView *view) ; 16 | 17 | /** 18 | * 创建视图的位置,放在左边还是右边 19 | */ 20 | typedef NS_ENUM(NSUInteger , NavigatioinViewPlaceType) { 21 | NavigatioinViewPlaceTypeNone , 22 | NavigatioinViewPlaceTypeLeft , 23 | NavigatioinViewPlaceTypeRight , 24 | NavigatioinViewPlaceTypeCenter , 25 | }; 26 | 27 | @class EasyNavigationButton ; 28 | 29 | @interface EasyNavigationView : UIView 30 | 31 | 32 | //背景视图,可以改变透明度,改变图片, 33 | @property (nonatomic,strong,readonly)UIImageView *backgroundView ; 34 | 35 | //下面的线条设置 36 | @property (nonatomic,strong,readonly)UIView *lineView ; 37 | 38 | //title设置 39 | @property (nonatomic,strong,readonly)UILabel *titleLabel ; 40 | 41 | //返回按钮设置 42 | @property (nonatomic,strong)UIButton *navigationBackButton ; 43 | /** 44 | * 导航栏返回按钮的事件(左上角的返回按钮,如果实现了它将不会调用库里面的pop或dismiss) 45 | */ 46 | @property (nonatomic,strong)clickCallback navigationBackButtonCallback ; 47 | 48 | 49 | 50 | //可以加一大堆简便方法 51 | //控件之间的距离 52 | //比如两个按钮之前的间隔,titleview很长的时候,与左右两边按钮的间隔 53 | //按钮与左右边缘的间隔 54 | @property (nonatomic,assign)CGFloat viewEdgeSpece ; 55 | 56 | //增加是否把view向下平移 57 | //@property (nonatomic,assign)BOOL titleViewCenterFixed ;//titleVie永远居中显示。默认为yes。(当为No的时候,左边按钮特别多的时候,会把titleview往右边挤,导致不居中) 58 | 59 | 60 | //重新布局导航条控件 61 | - (void)layoutNavSubViews ; 62 | 63 | 64 | 65 | #pragma mark - 添加视图 66 | /** 67 | * 往导航栏上添加一个视图 NOTE:请使用”EasyNavigationView+Add“中的方法 68 | */ 69 | - (void)addView:(UIView *)view clickCallback:(clickCallback)callback type:(NavigatioinViewPlaceType)type ; 70 | 71 | 72 | #pragma mark - 导航条滚动 73 | 74 | - (void)navigationScrollWithScrollView:(UIScrollView *)scrollowView 75 | config:(EasyNavigationScroll *(^)(void))config ; 76 | 77 | 78 | 79 | #pragma mark - 废弃方法 80 | 81 | //背景设备 82 | //@property (nonatomic,strong,readonly)UIView *backgroundView ; 83 | //@property (nonatomic,strong,readonly)UIImageView *backgroundImageView ; 84 | 85 | @property (nonatomic,strong)NSString *title ; 86 | /** 87 | * 导航条 左边/右边 所有视图 88 | */ 89 | @property (nonatomic,strong,readonly)NSMutableArray *leftViewArray ; 90 | @property (nonatomic,strong,readonly)NSMutableArray *rightViewArray ; 91 | 92 | 93 | 94 | 95 | 96 | //- (void)setTitle:(NSString *)title ; 97 | /** 98 | * 设置导航栏的背景图片 99 | * 设置导航栏的透明度 100 | * 设置导航栏的背景颜色 101 | */ 102 | - (void)setNavigationBackgroundImage:(UIImage *)backgroundImage ; 103 | - (void)setNavigationBackgroundAlpha:(CGFloat)alpha ; 104 | - (void)setNavigationBackgroundColor:(UIColor *)color ; 105 | 106 | /** 107 | * 导航栏点击事件 108 | */ 109 | //- (void)statusBarTapWithCallback:(clickCallback)callback ; 110 | //移除导航栏上的手势 111 | //- (void)removeStatusBarCallback ; 112 | 113 | 114 | /** 115 | * 创建一个按钮 116 | */ 117 | - (UIButton *)createButtonWithTitle:(NSString *)title 118 | backgroundImage:(UIImage *)backgroundImage 119 | image:(UIImage *)image 120 | hightImage:(UIImage *)hieghtImage 121 | callback:(clickCallback)callback 122 | type:(NavigatioinViewPlaceType)type ; 123 | 124 | - (void)removeView:(UIView *)view 125 | type:(NavigatioinViewPlaceType)type ; 126 | 127 | 128 | @end 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavigationView+LeftButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+LeftButton.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/30. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView+LeftButton.h" 10 | 11 | @implementation EasyNavigationView (LeftButton) 12 | 13 | 14 | - (void)addLeftView:(UIView *)view clickCallback:(clickCallback)callback 15 | { 16 | [self addView:view 17 | clickCallback:callback 18 | type:NavigatioinViewPlaceTypeLeft]; 19 | } 20 | 21 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 22 | clickCallBack:(clickCallback)callback 23 | { 24 | return [self createButtonWithTitle:title 25 | backgroundImage:nil 26 | image:nil 27 | hightImage:nil 28 | callback:callback 29 | type:NavigatioinViewPlaceTypeLeft]; 30 | } 31 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 32 | image:(UIImage *)image 33 | clickCallBack:(clickCallback)callback 34 | { 35 | return [self createButtonWithTitle:title 36 | backgroundImage:nil 37 | image:image 38 | hightImage:nil 39 | callback:callback 40 | type:NavigatioinViewPlaceTypeLeft]; 41 | } 42 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 43 | backgroundImage:(UIImage *)backgroundImage 44 | clickCallBack:(clickCallback)callback 45 | { 46 | return [self createButtonWithTitle:title 47 | backgroundImage:backgroundImage 48 | image:nil 49 | hightImage:nil 50 | callback:callback 51 | type:NavigatioinViewPlaceTypeLeft]; 52 | } 53 | 54 | - (UIButton *)addLeftButtonWithImage:(UIImage *)image 55 | clickCallBack:(clickCallback)callback 56 | { 57 | return [self createButtonWithTitle:nil 58 | backgroundImage:nil 59 | image:image 60 | hightImage:nil 61 | callback:callback 62 | type:NavigatioinViewPlaceTypeLeft]; 63 | } 64 | 65 | - (UIButton *)addLeftButtonWithImage:(UIImage *)image 66 | hightImage:(UIImage *)hightImage 67 | clickCallBack:(clickCallback)callback 68 | { 69 | return [self createButtonWithTitle:nil 70 | backgroundImage:nil 71 | image:image 72 | hightImage:hightImage 73 | callback:callback 74 | type:NavigatioinViewPlaceTypeLeft]; 75 | } 76 | - (UIButton *)addLeftButtonWithTitle:(NSString *)title 77 | image:(UIImage *)image 78 | hightImage:(UIImage *)hightImage 79 | backgroundImage:(UIImage *)backgroundImage 80 | clickCallBack:(clickCallback)callback 81 | { 82 | return [self createButtonWithTitle:title 83 | backgroundImage:backgroundImage 84 | image:image 85 | hightImage:hightImage 86 | callback:callback 87 | type:NavigatioinViewPlaceTypeLeft]; 88 | } 89 | 90 | 91 | - (void)removeLeftView:(UIView *)view 92 | { 93 | [self removeView:view type:NavigatioinViewPlaceTypeLeft]; 94 | } 95 | 96 | //- (void)removeAllLeftButton 97 | //{ 98 | // for (UIView *tempView in self.leftViewArray) { 99 | // [self removeView:tempView type:NavigatioinViewPlaceTypeLeft]; 100 | // } 101 | //} 102 | 103 | 104 | @end 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavButton/EasyNavigationView+RightButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationView+RightButton.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/30. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationView+RightButton.h" 10 | 11 | @implementation EasyNavigationView (RightButton) 12 | 13 | 14 | - (void)addRightView:(UIView *)view clickCallback:(clickCallback)callback 15 | { 16 | [self addView:view 17 | clickCallback:callback 18 | type:NavigatioinViewPlaceTypeRight]; 19 | } 20 | 21 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 22 | clickCallBack:(clickCallback)callback 23 | { 24 | return [self createButtonWithTitle:title 25 | backgroundImage:nil 26 | image:nil 27 | hightImage:nil 28 | callback:callback 29 | type:NavigatioinViewPlaceTypeRight]; 30 | } 31 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 32 | image:(UIImage *)image 33 | clickCallBack:(clickCallback)callback 34 | { 35 | return [self createButtonWithTitle:title 36 | backgroundImage:nil 37 | image:image 38 | hightImage:nil 39 | callback:callback 40 | type:NavigatioinViewPlaceTypeRight]; 41 | } 42 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 43 | backgroundImage:(UIImage *)backgroundImage 44 | clickCallBack:(clickCallback)callback 45 | { 46 | return [self createButtonWithTitle:title 47 | backgroundImage:backgroundImage 48 | image:nil 49 | hightImage:nil 50 | callback:callback 51 | type:NavigatioinViewPlaceTypeRight]; 52 | } 53 | 54 | - (UIButton *)addRightButtonWithImage:(UIImage *)image 55 | clickCallBack:(clickCallback)callback 56 | { 57 | return [self createButtonWithTitle:nil 58 | backgroundImage:nil 59 | image:image 60 | hightImage:nil 61 | callback:callback 62 | type:NavigatioinViewPlaceTypeRight]; 63 | } 64 | 65 | - (UIButton *)addRightButtonWithImage:(UIImage *)image 66 | hightImage:(UIImage *)hightImage 67 | clickCallBack:(clickCallback)callback 68 | { 69 | return [self createButtonWithTitle:nil 70 | backgroundImage:nil 71 | image:image 72 | hightImage:hightImage 73 | callback:callback 74 | type:NavigatioinViewPlaceTypeRight]; 75 | } 76 | - (UIButton *)addRightButtonWithTitle:(NSString *)title 77 | image:(UIImage *)image 78 | hightImage:(UIImage *)hightImage 79 | backgroundImage:(UIImage *)backgroundImage 80 | clickCallBack:(clickCallback)callback 81 | { 82 | return [self createButtonWithTitle:title 83 | backgroundImage:backgroundImage 84 | image:image 85 | hightImage:hightImage 86 | callback:callback 87 | type:NavigatioinViewPlaceTypeRight]; 88 | } 89 | 90 | 91 | 92 | 93 | - (void)removeRightView:(UIView *)view 94 | { 95 | [self removeView:view type:NavigatioinViewPlaceTypeRight]; 96 | } 97 | 98 | //- (void)removeAllRightButton 99 | //{ 100 | // for (UIView *tempView in self.rightViewArray) { 101 | // [self removeView:tempView type:NavigatioinViewPlaceTypeRight]; 102 | // } 103 | //} 104 | 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Sliding/NavCustomSlidingViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationOptions.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationOptions.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/9/11. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationOptions.h" 10 | 11 | @implementation EasyNavigationOptions 12 | 13 | static EasyNavigationOptions *_navigationShare = nil ; 14 | + (instancetype)shareInstance 15 | { 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | _navigationShare = [[EasyNavigationOptions alloc] init]; 19 | }); 20 | return _navigationShare; 21 | } 22 | + (instancetype)allocWithZone:(struct _NSZone *)zone 23 | { 24 | static dispatch_once_t onceToken; 25 | dispatch_once(&onceToken,^{ 26 | _navigationShare = [super allocWithZone:zone]; 27 | }); 28 | return _navigationShare; 29 | } 30 | - (id)copyWithZone:(NSZone *)zone 31 | { 32 | return _navigationShare; 33 | } 34 | 35 | - (id)mutableCopyWithZone:(NSZone *)zone 36 | { 37 | return _navigationShare; 38 | } 39 | - (instancetype)init 40 | { 41 | if (self = [super init]) { 42 | 43 | _navbigTitleType = NavBigTitleTypeDefault ; 44 | _navTitleAnimationType = NavTitleAnimationTypeStiffFade ; 45 | 46 | _backGroundAlpha = 1.0f ; 47 | 48 | _navBackGroundColor = [UIColor whiteColor]; 49 | _navLineColor = [UIColor groupTableViewBackgroundColor]; 50 | 51 | _titleFont = [UIFont boldSystemFontOfSize:18]; 52 | _titleBigFount = [UIFont boldSystemFontOfSize:35] ; 53 | _titleColor = [UIColor darkTextColor]; 54 | 55 | _buttonTitleFont = [UIFont systemFontOfSize:16]; 56 | _buttonTitleColor = [UIColor blueColor] ; 57 | _buttonTitleColorHieght = [[UIColor blueColor] colorWithAlphaComponent:0.3]; 58 | 59 | } 60 | return self ; 61 | } 62 | 63 | 64 | - (void)setBackGroundAlpha:(CGFloat)backGroundAlpha 65 | { 66 | if (_backGroundAlpha < 0) { 67 | _backGroundAlpha = 0 ; 68 | NSAssert(NO, @"backGroundAlpha is illegal"); 69 | } 70 | _backGroundAlpha = backGroundAlpha ; 71 | } 72 | 73 | - (void)setNavBackGroundColor:(UIColor *)navBackGroundColor 74 | { 75 | if ([navBackGroundColor isKindOfClass:[UIColor class]]) { 76 | _navBackGroundColor = navBackGroundColor ; 77 | } 78 | else{ 79 | NSAssert(NO, @"navBackGroundColor is illegal"); 80 | } 81 | } 82 | 83 | - (void)setNavLineColor:(UIColor *)navLineColor 84 | { 85 | if ([navLineColor isKindOfClass:[UIColor class]]) { 86 | _navLineColor = navLineColor ; 87 | } 88 | else{ 89 | NSAssert(NO, @"navLineColor is illegal"); 90 | } 91 | } 92 | 93 | - (void)setNavBackgroundImage:(UIImage *)navBackgroundImage 94 | { 95 | if ([navBackgroundImage isKindOfClass:[UIImage class]]) { 96 | _navBackgroundImage = navBackgroundImage ; 97 | } 98 | else{ 99 | NSAssert(NO, @"navBackgroundImage is illegal"); 100 | } 101 | } 102 | 103 | - (void)setTitleFont:(UIFont *)titleFont 104 | { 105 | if ([titleFont isKindOfClass:[UIFont class]]) { 106 | _titleFont = titleFont ; 107 | } 108 | else{ 109 | NSAssert(NO, @"titleFont is illegal"); 110 | } 111 | } 112 | 113 | - (void)setTitleColor:(UIColor *)titleColor 114 | { 115 | if ([titleColor isKindOfClass:[UIColor class]]) { 116 | _titleColor = titleColor ; 117 | } 118 | else{ 119 | NSAssert(NO, @"titleColor is illegal"); 120 | } 121 | } 122 | 123 | - (void)setButtonTitleFont:(UIFont *)buttonTitleFont 124 | { 125 | if ([buttonTitleFont isKindOfClass:[UIFont class]]) { 126 | _buttonTitleFont = buttonTitleFont ; 127 | } 128 | else{ 129 | NSAssert(NO, @"buttonTitleFont is illegal"); 130 | } 131 | } 132 | 133 | - (void)setButtonTitleColor:(UIColor *)buttonTitleColor 134 | { 135 | if ([buttonTitleColor isKindOfClass:[UIColor class]]) { 136 | _buttonTitleColor = buttonTitleColor ; 137 | } 138 | else{ 139 | NSAssert(NO, @"buttonTitleColor is illegal"); 140 | } 141 | } 142 | 143 | - (void)setButtonTitleColorHieght:(UIColor *)buttonTitleColorHieght 144 | { 145 | if ([buttonTitleColorHieght isKindOfClass:[UIColor class]]) { 146 | _buttonTitleColorHieght = buttonTitleColorHieght ; 147 | } 148 | else{ 149 | NSAssert(NO, @"buttonTitleColorHieght is illegal"); 150 | } 151 | } 152 | 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /EasyNavigationDemo/StatusBar/NavStatusBarViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /EasyNavigationDemo/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 | 29 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/nf.xcuserdatad/xcschemes/EasyNavigationDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 44 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 65 | 76 | 78 | 84 | 85 | 86 | 87 | 91 | 92 | 93 | 94 | 95 | 96 | 102 | 104 | 110 | 111 | 112 | 113 | 115 | 116 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /EasyNavigationDemo.xcodeproj/xcuserdata/Mr_Chen.xcuserdatad/xcschemes/EasyNavigationDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 44 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 65 | 76 | 78 | 84 | 85 | 86 | 87 | 91 | 92 | 96 | 97 | 98 | 99 | 105 | 107 | 113 | 114 | 115 | 116 | 118 | 119 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /EasyNavigationDemo/Operate/NavOperateViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NavOperateViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NavOperateViewController.h" 10 | 11 | @interface NavOperateViewController () 12 | 13 | @property (nonatomic,strong)NSArray *dataArray ; 14 | 15 | @end 16 | 17 | @implementation NavOperateViewController 18 | - (void)dealloc 19 | { 20 | 21 | } 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | [self.navigationView setTitle:@"随意操作导航条"]; 26 | 27 | UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth_N(), 180)]; 28 | label.numberOfLines = 0 ; 29 | label.backgroundColor = [UIColor lightGrayColor]; 30 | label.textAlignment = NSTextAlignmentCenter ; 31 | label.text = @"\n以下操作只会对本导航条起作用。\n如果想改变整个工程中导航条属性,请设置EasyNavigationOptions.h中的属性"; 32 | self.tableView.tableHeaderView = label ; 33 | self.statusBarStyle = UIStatusBarStyleLightContent ; 34 | // self.navbigTitleType = NavBigTitleTypeIOS11 ; 35 | 36 | } 37 | 38 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 39 | { 40 | return self.dataArray.count ; 41 | } 42 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 43 | { 44 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath]; 45 | cell.accessoryType = UITableViewCellStyleValue1; 46 | cell.textLabel.textColor = [UIColor blueColor]; 47 | cell.textLabel.text = self.dataArray[indexPath.row]; 48 | return cell; 49 | } 50 | 51 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | switch (indexPath.row) { 54 | case 0: 55 | { 56 | kWeakSelf(self) 57 | [self.navigationView addLeftButtonWithTitle:@"新增按钮" callback:^(UIView *view) { 58 | [weakself.navigationController popViewControllerAnimated:YES]; 59 | 60 | }]; 61 | // [self.navigationView addLeftButtonWithTitle:@"新增按钮" clickCallBack:^(UIView *view) { 62 | // [weakself.navigationController popViewControllerAnimated:YES]; 63 | // }]; 64 | 65 | }break; 66 | case 1: 67 | { 68 | if (self.navigationView.navigationBackButton) { 69 | [self.navigationView.navigationBackButton removeFromSuperview]; 70 | self.navigationView.navigationBackButton = nil ; 71 | } 72 | }break; 73 | case 2: 74 | { 75 | [self.navigationView setTitle:@"我是标题"]; 76 | }break; 77 | case 3: 78 | { 79 | self.navigationView.titleLabel.font = [UIFont boldSystemFontOfSize:22]; 80 | self.navigationView.titleLabel.textColor = [UIColor redColor]; 81 | }break; 82 | case 4: 83 | { 84 | __block UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100, -10, ScreenWidth_N()-180, NavigationHeight_N() + 20)]; 85 | view.backgroundColor = [UIColor purpleColor]; 86 | [self.navigationView addSubview:view callback:^(UIView *view) { 87 | [view removeFromSuperview]; 88 | }]; 89 | }break; 90 | case 5: 91 | { 92 | [self.navigationView.backgroundView setImage:[EasyNavigationUtils createImageWithColor:[UIColor orangeColor]]]; 93 | }break; 94 | case 6: 95 | { 96 | self.navigationView.hidden = YES ; 97 | // if (self.navigationView) { 98 | // [self.navigationView removeFromSuperview]; 99 | // self.navigationView = nil ; 100 | // } 101 | }break; 102 | case 7: 103 | { 104 | self.navigationView.hidden = NO ; 105 | // if (!self.navigationView) { 106 | // EasyNavigationView *nav = [[EasyNavigationView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH , NAV_HEIGHT)]; 107 | // [self setNavigationView:nav]; 108 | // [self.view addSubview:nav]; 109 | // } 110 | }break ; 111 | default: 112 | break; 113 | } 114 | } 115 | - (NSArray *)dataArray 116 | { 117 | if (nil == _dataArray) { 118 | _dataArray = @[ 119 | @"左边增加一个按钮", 120 | @"删除返回按钮", 121 | @"增加一个标题", 122 | @"改变标题的字体", 123 | @"增加一个视图", 124 | @"改变导航条背景颜色", 125 | @"移除导航条", 126 | @"添加导航条"]; 127 | } 128 | return _dataArray ; 129 | } 130 | - (void)didReceiveMemoryWarning { 131 | [super didReceiveMemoryWarning]; 132 | // Dispose of any resources that can be recreated. 133 | } 134 | 135 | /* 136 | #pragma mark - Navigation 137 | 138 | // In a storyboard-based application, you will often want to do a little preparation before navigation 139 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 140 | // Get the new view controller using [segue destinationViewController]. 141 | // Pass the selected object to the new view controller. 142 | } 143 | */ 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/UIView+EasyNavigationExt.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+EasyNavigationExt.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/11. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "UIView+EasyNavigationExt.h" 10 | 11 | #import 12 | 13 | @implementation UIView (EasyNavigationExt) 14 | 15 | 16 | - (CGFloat)Easy_x { 17 | return self.frame.origin.x; 18 | } 19 | - (void)setEasy_x:(CGFloat)Easy_x { 20 | CGRect frame = self.frame; 21 | frame.origin.x = Easy_x; 22 | self.frame = frame; 23 | } 24 | - (CGFloat)Easy_y { 25 | return self.frame.origin.y; 26 | } 27 | 28 | - (void)setEasy_y:(CGFloat)Easy_y { 29 | CGRect frame = self.frame; 30 | frame.origin.y = Easy_y; 31 | self.frame = frame; 32 | } 33 | - (CGFloat)Easy_width { 34 | return self.frame.size.width; 35 | } 36 | 37 | - (void)setEasy_width:(CGFloat)Easy_width { 38 | CGRect frame = self.frame; 39 | frame.size.width = Easy_width; 40 | self.frame = frame; 41 | } 42 | 43 | - (CGFloat)Easy_height { 44 | return self.frame.size.height; 45 | } 46 | 47 | - (void)setEasy_height:(CGFloat)Easy_height { 48 | CGRect frame = self.frame; 49 | frame.size.height = Easy_height; 50 | self.frame = frame; 51 | } 52 | 53 | 54 | - (CGFloat)Easy_centerX { 55 | return self.center.x; 56 | } 57 | 58 | - (void)setEasy_centerX:(CGFloat)Easy_centerX { 59 | self.center = CGPointMake(Easy_centerX, self.center.y); 60 | } 61 | 62 | - (CGFloat)Easy_centerY { 63 | return self.center.y; 64 | } 65 | 66 | - (void)setEasy_centerY:(CGFloat)Easy_centerY { 67 | self.center = CGPointMake(self.center.x, Easy_centerY); 68 | } 69 | 70 | 71 | 72 | - (CGFloat)Easy_left { 73 | return self.frame.origin.x; 74 | } 75 | 76 | - (void)setEasy_left:(CGFloat)Easy_x { 77 | CGRect frame = self.frame; 78 | frame.origin.x = Easy_x; 79 | self.frame = frame; 80 | } 81 | 82 | - (CGFloat)Easy_top { 83 | return self.frame.origin.y; 84 | } 85 | 86 | - (void)setEasy_top:(CGFloat)Easy_y { 87 | CGRect frame = self.frame; 88 | frame.origin.y = Easy_y; 89 | self.frame = frame; 90 | } 91 | 92 | - (CGFloat)Easy_right { 93 | return self.frame.origin.x + self.frame.size.width; 94 | } 95 | 96 | - (void)setEasy_right:(CGFloat)Easy_right { 97 | CGRect frame = self.frame; 98 | frame.origin.x = Easy_right - frame.size.width; 99 | self.frame = frame; 100 | } 101 | 102 | - (CGFloat)Easy_bottom { 103 | return self.frame.origin.y + self.frame.size.height; 104 | } 105 | 106 | - (void)setEasy_bottom:(CGFloat)Easy_bottom { 107 | CGRect frame = self.frame; 108 | frame.origin.y = Easy_bottom - frame.size.height; 109 | self.frame = frame; 110 | } 111 | 112 | 113 | - (void (^)(UIView *))Easy_didAddsubView 114 | { 115 | return objc_getAssociatedObject(self, _cmd); 116 | } 117 | 118 | - (void)setEasy_didAddsubView:(void (^)(UIView *))Easy_didAddsubView 119 | { 120 | objc_setAssociatedObject(self, @selector(Easy_didAddsubView), Easy_didAddsubView, OBJC_ASSOCIATION_COPY_NONATOMIC); 121 | } 122 | 123 | 124 | + (void)load 125 | { 126 | static dispatch_once_t onceToken; 127 | dispatch_once(&onceToken, ^{ 128 | //方法交换。当有视图加到这个view上时,得到通知 129 | Class viewClass = [UIView class]; 130 | 131 | SEL originalSelector = @selector(addSubview:); 132 | SEL swizzledSelector = @selector(Easy_easyAddSubview:); 133 | 134 | Method originalMethod = class_getInstanceMethod(viewClass, originalSelector); 135 | Method swizzledMethod = class_getInstanceMethod(viewClass, swizzledSelector); 136 | 137 | BOOL didAddMethod = 138 | class_addMethod(viewClass, 139 | originalSelector, 140 | method_getImplementation(swizzledMethod), 141 | method_getTypeEncoding(swizzledMethod)); 142 | 143 | if (didAddMethod) { 144 | class_replaceMethod(viewClass, 145 | swizzledSelector, 146 | method_getImplementation(originalMethod), 147 | method_getTypeEncoding(originalMethod)); 148 | } 149 | else { 150 | method_exchangeImplementations(originalMethod, swizzledMethod); 151 | } 152 | }); 153 | } 154 | 155 | 156 | - (void)Easy_easyAddSubview:(UIView *)view 157 | { 158 | [self Easy_easyAddSubview:view]; 159 | 160 | if (self.Easy_didAddsubView) { 161 | self.Easy_didAddsubView(view); 162 | } 163 | } 164 | 165 | 166 | - (UIViewController *)Easy_viewCurrentViewController 167 | { 168 | for (UIView* next = [self superview]; next; next = next.superview) { 169 | UIResponder *nextResponder = [next nextResponder]; 170 | if ([nextResponder isKindOfClass:[UIViewController class]]) { 171 | return (UIViewController *)nextResponder; 172 | } 173 | } 174 | return [self topViewController]; 175 | } 176 | 177 | - (UIViewController *)topViewController { 178 | UIViewController *resultVC; 179 | resultVC = [self _topViewController:[[UIApplication sharedApplication].keyWindow rootViewController]]; 180 | while (resultVC.presentedViewController) { 181 | resultVC = [self _topViewController:resultVC.presentedViewController]; 182 | } 183 | return resultVC; 184 | } 185 | 186 | - (UIViewController *)_topViewController:(UIViewController *)vc { 187 | if ([vc isKindOfClass:[UINavigationController class]]) { 188 | return [self _topViewController:[(UINavigationController *)vc topViewController]]; 189 | } else if ([vc isKindOfClass:[UITabBarController class]]) { 190 | return [self _topViewController:[(UITabBarController *)vc selectedViewController]]; 191 | } else { 192 | return vc; 193 | } 194 | return nil; 195 | } 196 | 197 | - (void)Easy_addTapCallBack:(id)target sel:(SEL)selector 198 | { 199 | self.userInteractionEnabled = YES; 200 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:target action:selector]; 201 | [self addGestureRecognizer:tap]; 202 | } 203 | 204 | @end 205 | -------------------------------------------------------------------------------- /EasyNavigationDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by Mr_Chen on 17/8/31. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "EasyNavigation.h" 12 | 13 | 14 | #import "NavEmptyViewController.h" 15 | #import "NavTransparentViewController.h" 16 | #import "NavAlphaChangeViewController.h" 17 | #import "NavOperateViewController.h" 18 | 19 | #import "NavSmoothHidenViewController.h" 20 | #import "NavSmoothHiden_1_ViewController.h" 21 | #import "NavAnimationHidenViewController.h" 22 | #import "NavAnimationHiden_1_ViewController.h" 23 | 24 | #import "NavCustomSlidingViewController.h" 25 | #import "NavSystemSlidingViewController.h" 26 | #import "NavScrollIncludeViewController.h" 27 | 28 | #import "NavStatusBarViewController.h" 29 | 30 | 31 | @interface ViewController () 32 | 33 | @property (nonatomic,strong)UITableView *tableView ; 34 | @property (nonatomic,strong)NSArray *dataArray ; 35 | @property (nonatomic,strong)NSArray *navDataArray ; 36 | 37 | @end 38 | 39 | @implementation ViewController 40 | - (void)viewDidAppear:(BOOL)animated 41 | { 42 | [super viewDidAppear:animated ]; 43 | } 44 | - (void)viewDidLoad { 45 | [super viewDidLoad]; 46 | 47 | [self.navigationView setTitle:@"首页"]; 48 | 49 | self.navigationView.backgroundView.image = nil ; 50 | self.navigationView.backgroundView.backgroundColor = [UIColor blueColor]; 51 | self.navigationView.backgroundView.alpha = 0.3 ; 52 | 53 | 54 | // [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]; 55 | // UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth_N(), 60)]; 56 | // img.backgroundColor = [UIColor lightGrayColor]; 57 | // self.tableView.tableHeaderView =img ; 58 | [self.view addSubview:self.tableView]; 59 | } 60 | 61 | 62 | #pragma mark - Tableview datasource 63 | 64 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 65 | { 66 | return self.dataArray.count ; 67 | } 68 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 69 | { 70 | return [self.dataArray[section] count]; 71 | } 72 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath]; 75 | cell.accessoryType = UITableViewCellStyleValue1; 76 | cell.textLabel.textColor = [UIColor blueColor]; 77 | cell.textLabel.text = self.dataArray[indexPath.section][indexPath.row]; 78 | 79 | return cell ; 80 | } 81 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 82 | { 83 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 84 | 85 | Class tempVC = self.navDataArray[indexPath.section][indexPath.row] ; 86 | BaseViewController *vc = [[tempVC alloc]init]; 87 | [self.navigationController pushViewController:vc animated:YES]; 88 | } 89 | 90 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 91 | { 92 | return 10 ; 93 | } 94 | 95 | #pragma mark - getter/setter 96 | - (UITableView *)tableView 97 | { 98 | if (nil == _tableView) { 99 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds]; 100 | _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 101 | _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 102 | _tableView.contentInset = UIEdgeInsetsMake(NavigationHeight_N(), 0, 0, 0); 103 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]; 104 | _tableView.dataSource = self ; 105 | _tableView.delegate = self ; 106 | if (@available(iOS 11.0, *)) { 107 | _tableView.estimatedRowHeight = 0; 108 | _tableView.estimatedSectionHeaderHeight = 0; 109 | _tableView.estimatedSectionFooterHeight = 0; 110 | _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever ; 111 | } 112 | 113 | UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth_N(), 60)]; 114 | img.backgroundColor = [UIColor lightGrayColor]; 115 | _tableView.tableHeaderView =img ; 116 | } 117 | return _tableView ; 118 | } 119 | 120 | - (NSArray *)dataArray 121 | { 122 | if (nil == _dataArray) { 123 | _dataArray = @[ 124 | @[@"导航栏操作"], 125 | @[ @"透明", @"导航条渐变"], 126 | @[@"无导航条",@"导航条滚动隐藏", @"导航条滚动隐藏(statusBar下停止)", @"导航条动画隐藏", @"导航条动画隐藏(statusBar下停止)"], 127 | @[@"禁用系统返回手势", @"自定义返回手势", @"嵌套scrollview返回"], 128 | @[@"statusBar状态改变"]]; 129 | } 130 | return _dataArray ; 131 | } 132 | - (NSArray *)navDataArray 133 | { 134 | if (nil == _navDataArray) { 135 | _navDataArray = @[ 136 | @[[NavOperateViewController class]], 137 | @[[NavTransparentViewController class], 138 | [NavAlphaChangeViewController class]], 139 | @[[NavEmptyViewController class], 140 | [NavSmoothHidenViewController class], 141 | [NavSmoothHiden_1_ViewController class], 142 | [NavAnimationHidenViewController class], 143 | [NavAnimationHiden_1_ViewController class]], 144 | @[[NavSystemSlidingViewController class], 145 | [NavCustomSlidingViewController class], 146 | [NavScrollIncludeViewController class]], 147 | @[[NavStatusBarViewController class]] 148 | ]; 149 | } 150 | return _navDataArray ; 151 | } 152 | 153 | 154 | 155 | 156 | - (void)didReceiveMemoryWarning { 157 | [super didReceiveMemoryWarning]; 158 | // Dispose of any resources that can be recreated. 159 | } 160 | 161 | 162 | @end 163 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavExt/NSObject+EasyKVO.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+EasyKVO.m 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/10/19. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "NSObject+EasyKVO.h" 10 | 11 | #import 12 | #import 13 | 14 | #define EasyKVOPrefix @"EasyKVO_" 15 | #define EasyAssociateArrayKey @"EasyAssociateArrayKey" 16 | 17 | @implementation NSObject (EasyKVO) 18 | 19 | - (void)easyAddObserver:(id)observer key:(NSString *)key callback:(EasyKOVCallback)callback 20 | { 21 | 22 | // 1. 检查对象的类有没有相应的 setter 方法。如果没有抛出异常 23 | SEL setterSelector = NSSelectorFromString([self setterForGetter:key]); 24 | 25 | Method setterMethod = class_getInstanceMethod([self class], setterSelector); 26 | 27 | if (!setterMethod) { 28 | NSLog(@"找不到该方法"); 29 | return; 30 | } 31 | 32 | // 2. 检查对象 isa 指向的类是不是一个 KVO 类。如果不是,新建一个继承原来类的子类,并把 isa 指向这个新建的子类 33 | Class clazz = object_getClass(self); 34 | NSString *className = NSStringFromClass(clazz); 35 | 36 | if (![className hasPrefix:EasyKVOPrefix]) { 37 | clazz = [self jr_KVOClassWithOriginalClassName:className]; 38 | object_setClass(self, clazz); 39 | } 40 | 41 | // 3. 为kvo class添加setter方法的实现 42 | const char *types = method_getTypeEncoding(setterMethod); 43 | class_addMethod(clazz, setterSelector, (IMP)jr_setter, types); 44 | 45 | // 4. 添加该观察者到观察者列表中 46 | // 4.1 创建观察者的信息 47 | EasyKVOInfo *info = [[EasyKVOInfo alloc] init]; 48 | info.observer = observer ; 49 | info.key = key ; 50 | info.callback = callback ; 51 | // 4.2 获取关联对象(装着所有监听者的数组) 52 | NSMutableArray *observers = objc_getAssociatedObject(self, EasyAssociateArrayKey); 53 | if (!observers) { 54 | observers = [NSMutableArray array]; 55 | objc_setAssociatedObject(self, EasyAssociateArrayKey, observers, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 56 | } 57 | 58 | [observers addObject:info]; 59 | 60 | } 61 | 62 | - (Class)jr_KVOClassWithOriginalClassName:(NSString *)className 63 | { 64 | NSString *kvoClassName = [EasyKVOPrefix stringByAppendingString:className]; 65 | Class kvoClass = NSClassFromString(kvoClassName); 66 | 67 | // 如果kvo class存在则返回 68 | if (kvoClass) { 69 | return kvoClass; 70 | } 71 | 72 | // 如果kvo class不存在, 则创建这个类 73 | Class originClass = object_getClass(self); 74 | kvoClass = objc_allocateClassPair(originClass, kvoClassName.UTF8String, 0); 75 | 76 | // 修改kvo class方法的实现 77 | Method clazzMethod = class_getInstanceMethod(kvoClass, @selector(class)); 78 | const char *types = method_getTypeEncoding(clazzMethod); 79 | class_addMethod(kvoClass, @selector(class), (IMP)jr_class, types); 80 | 81 | objc_registerClassPair(kvoClass); 82 | 83 | return kvoClass; 84 | 85 | } 86 | 87 | /** 88 | * 模仿Apple的做法, 欺骗人们这个kvo类还是原类 89 | */ 90 | Class jr_class(id self, SEL cmd) 91 | { 92 | Class clazz = object_getClass(self); 93 | Class superClazz = class_getSuperclass(clazz); 94 | return superClazz; 95 | } 96 | 97 | /** 98 | * 重写setter方法, 新方法在调用原方法后, 通知每个观察者(调用传入的block) 99 | */ 100 | static void jr_setter(id self, SEL _cmd, id newValue) 101 | { 102 | NSString *setterName = NSStringFromSelector(_cmd); 103 | NSString *getterName = [self getterForSetter:setterName]; 104 | 105 | 106 | if (!getterName) { 107 | NSLog(@"找不到getter方法"); 108 | } 109 | 110 | // 获取旧值 111 | id oldValue = [self valueForKey:getterName]; 112 | 113 | // 调用原类的setter方法 114 | 115 | struct objc_super superClazz = { 116 | .receiver = self, 117 | .super_class = class_getSuperclass(object_getClass(self)) 118 | }; 119 | 120 | ((void (*)(void *, SEL, id))objc_msgSendSuper)(&superClazz, _cmd, newValue); 121 | 122 | // 为什么不能用下面方法代替上面方法? 123 | // ((void (*)(id, SEL, id))objc_msgSendSuper)(self, _cmd, newValue); 124 | 125 | 126 | // 找出观察者的数组, 调用对应对象的callback 127 | NSMutableArray *observers = objc_getAssociatedObject(self, EasyAssociateArrayKey); 128 | // 遍历数组 129 | for (EasyKVOInfo *info in observers) { 130 | if ([info.key isEqualToString:getterName]) { 131 | // gcd异步调用callback 132 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 133 | info.callback(info.observer, getterName, oldValue, newValue); 134 | }); 135 | } 136 | } 137 | } 138 | 139 | - (void)easyRemoveObserver:(id)observer key:(NSString *)key 140 | { 141 | NSMutableArray *observers = objc_getAssociatedObject(self, EasyAssociateArrayKey); 142 | if (!observers) return; 143 | 144 | for (EasyKVOInfo *info in observers) { 145 | if([info.key isEqualToString:key]) { 146 | [observers removeObject:info]; 147 | break; 148 | } 149 | } 150 | } 151 | 152 | 153 | #pragma mark - 私有方法 154 | 155 | /** 156 | * 根据getter方法名返回setter方法名 157 | */ 158 | - (NSString *)setterForGetter:(NSString *)key 159 | { 160 | // name -> Name -> setName: 161 | 162 | // 1. 首字母转换成大写 163 | unichar c = [key characterAtIndex:0]; 164 | NSString *str = [key stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:[NSString stringWithFormat:@"%c", c-32]]; 165 | 166 | // 2. 最前增加set, 最后增加: 167 | NSString *setter = [NSString stringWithFormat:@"set%@:", str]; 168 | 169 | return setter; 170 | 171 | } 172 | 173 | /** 174 | * 根据setter方法名返回getter方法名 175 | */ 176 | - (NSString *)getterForSetter:(NSString *)key 177 | { 178 | // setName: -> Name -> name 179 | 180 | // 1. 去掉set 181 | NSRange range = [key rangeOfString:@"set"]; 182 | 183 | NSString *subStr1 = [key substringFromIndex:range.location + range.length]; 184 | 185 | // 2. 首字母转换成大写 186 | unichar c = [subStr1 characterAtIndex:0]; 187 | NSString *subStr2 = [subStr1 stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:[NSString stringWithFormat:@"%c", c+32]]; 188 | 189 | // 3. 去掉最后的: 190 | NSRange range2 = [subStr2 rangeOfString:@":"]; 191 | NSString *getter = [subStr2 substringToIndex:range2.location]; 192 | 193 | return getter; 194 | } 195 | 196 | @end 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationUtils.h 3 | // EasyNavigationDemo 4 | // 5 | // Created by nf on 2017/9/7. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | //屏幕宽度 14 | CG_INLINE CGFloat ScreenWidth_N(void){ 15 | return [[UIScreen mainScreen] bounds].size.width ; 16 | } 17 | 18 | //屏幕高度 19 | CG_INLINE CGFloat ScreenHeight_N(void){ 20 | return [[UIScreen mainScreen] bounds].size.height ; 21 | } 22 | 23 | //屏幕最大的宽度 24 | CG_INLINE CGFloat ScreenMaxWidth_N(void){ 25 | return MAX(ScreenWidth_N(),ScreenHeight_N()) ; 26 | } 27 | 28 | //状态栏最大的宽度 29 | CG_INLINE CGFloat StatusBarMaxWidth_N(void){ 30 | CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; 31 | return MAX(CGRectGetMaxX(statusBarFrame), CGRectGetMaxY(statusBarFrame)) ; 32 | } 33 | 34 | //屏幕是否处于横屏状态 35 | CG_INLINE BOOL ScreenIsHorizontal_N(void){ 36 | return StatusBarMaxWidth_N == ScreenMaxWidth_N ; 37 | } 38 | 39 | //导航栏原始高度 (导航栏高度除去satatusbar后的高度) 40 | CG_INLINE CGFloat NavigationNorlmalHeight_N(void){ 41 | return 44.0f ; 42 | } 43 | 44 | //导航栏大标题增加出来的高度 45 | CG_INLINE CGFloat NavigationBigTitleAdditionHeight_N(void){ 46 | return 55.0f ; 47 | } 48 | 49 | //状态栏初始高度 50 | CG_INLINE CGFloat StatusBarOrginalHeight_N(void){ 51 | 52 | CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; 53 | CGFloat statusBarOffset = MIN(CGRectGetMaxX(statusBarFrame), CGRectGetMaxY(statusBarFrame)); 54 | if (statusBarOffset == 40.0f) { 55 | statusBarOffset -= 20.0f; 56 | } 57 | return statusBarOffset ; 58 | } 59 | 60 | //是否是iPhoneX 61 | CG_INLINE BOOL IsIphoneX_N(void){ 62 | return (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)&&(ScreenMaxWidth_N()==812.0f) ; 63 | } 64 | //状态栏高度 65 | CG_INLINE CGFloat StatusBarHeight_N(void){ 66 | return (ScreenIsHorizontal_N()&&IsIphoneX_N()) ? 0 : StatusBarOrginalHeight_N() ; 67 | } 68 | //导航栏高度 69 | CG_INLINE CGFloat NavigationHeight_N(void){ 70 | return NavigationNorlmalHeight_N() + StatusBarHeight_N(); 71 | } 72 | 73 | 74 | //安全线程 75 | CG_INLINE void dispatch_main_async_safe_easyN(dispatch_block_t block){ 76 | 77 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) { 78 | block(); 79 | } else { 80 | dispatch_async(dispatch_get_main_queue(), block); 81 | } 82 | } 83 | //延时执行 84 | CG_INLINE void dispatch_delay_easyN(CGFloat time , dispatch_block_t block){ 85 | 86 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), block); 87 | } 88 | 89 | 90 | // 过期提醒 91 | #define EasyNavigationDeprecated(instead) __deprecated_msg(instead) 92 | 93 | 94 | 95 | /* 96 | * 97 | * 98 | * 99 | **** ********************************************** 100 | * 以下注释掉的内容,如果在工程中其他地方用到,可以用上面的inline函数,给您带来不便,请谅解。 101 | ********************************************** 102 | * 103 | * 104 | * 105 | * 106 | */ 107 | //屏幕宽高 108 | //#define SCREEN_WIDTH_N [[UIScreen mainScreen] bounds].size.width 109 | //#define SCREEN_HEIGHT_N [[UIScreen mainScreen] bounds].size.height 110 | // 111 | ////屏幕的最大高度 112 | //#define SCREEN_MAX_LENGTH_N (MAX(SCREEN_WIDTH, SCREEN_HEIGHT)) 113 | ////状态栏的宽度 114 | //#define STATUSBAR_MAX_LENGTH_N MAX([UIApplication sharedApplication].statusBarFrame.size.height, [UIApplication sharedApplication].statusBarFrame.size.width) 115 | // 116 | ////是否处于横屏状态 117 | //#define ISHORIZONTA_N (STATUSBAR_MAX_LENGTH_N == SCREEN_MAX_LENGTH_N) 118 | // 119 | ////导航栏原始高度 120 | //#define kNavNormalHeight_N 44.0f 121 | // 122 | ////大标题增加出来的高度 123 | //#define kNavBigTitleHeight_N 55.0f 124 | // 125 | ////状态栏初始高度 126 | //#define kStatusBarHeight_N ([UIApplication sharedApplication].statusBarFrame.size.height) 127 | ////状态栏高度 128 | //#define kStatusBarHeight_N ((ISHORIZONTA_N&&ISIPHONE_X) ? 0 : kStatusBarHeight_N ) 129 | 130 | 131 | //retain屏 132 | //#define ISRETAIN ([[UIScreen mainScreen] scale] >= 2.0) 133 | //屏幕尺寸判断 134 | //#define ISIPHONE_4 (ISIPHONE && SCREEN_MAX_LENGTH == 480.0f) // 4/4s 3.5寸 320*480 135 | //#define ISIPHONE_5 (ISIPHONE && SCREEN_MAX_LENGTH == 568.0f) // 5/5s/se 4寸 320*568 136 | //#define ISIPHONE_6 (ISIPHONE && SCREEN_MAX_LENGTH == 667.0f) // 6/6s/7/8 4.7寸 375*667 137 | //#define ISIPHONE_6P (ISIPHONE && SCREEN_MAX_LENGTH == 736.0f) // 6p/6ps/7p/8p 5.5寸 414*736 138 | 139 | //iOS版本判断 140 | //#define SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) 141 | //#define IS_IOS7_OR_LATER (SYSTEM_VERSION >= 7.0) 142 | //#define IS_IOS8_OR_LATER (SYSTEM_VERSION >= 8.0) 143 | //#define IS_IOS9_OR_LATER (SYSTEM_VERSION >= 9.0) 144 | //#define IS_IOS10_OR_LATER (SYSTEM_VERSION >= 10.0) 145 | //#define IS_IOS11_OR_LATER (SYSTEM_VERSION >= 11.0) 146 | 147 | 148 | //bundle中的图片 149 | #define EasyImageFile_N(file) [@"EasyNavButton.bundle" stringByAppendingPathComponent:file] 150 | 151 | 152 | //强弱引用 153 | //#define kWeakSelf(type) __weak typeof(type) weak##type = type; 154 | //#define kStrongSelf(type) __strong typeof(type) type = weak##type; 155 | 156 | // 是否为空 157 | #define ISEMPTY_N(_v) (_v == nil || _v.length == 0) 158 | 159 | /**打印****/ 160 | #define ISSHOWNAVIGATIONLOG 1 161 | #define EasyLog_N(fmt, ...) if(ISSHOWNAVIGATIONLOG) { NSLog(fmt,##__VA_ARGS__); } 162 | 163 | 164 | /*随机颜色*/ 165 | #define kColorRandom_N kColor_N(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) 166 | #define kColor_N(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] 167 | 168 | 169 | /** 170 | * 显示大标题的条件 171 | */ 172 | typedef NS_ENUM(NSUInteger , NavBigTitleType) { 173 | NavBigTitleTypeUnknow = 0 , //没有设置大标题属性 174 | NavBigTitleTypeDefault = 1 << 0, //所有情况下都不使用大标题 (默认情况) 175 | NavBigTitleTypeIOS11 = 1 << 1 , //在iOS11系统上使用大标题 176 | NavBigTitleTypePlus = 1 << 2 , //在plus尺寸上使用大标题(iphone6plus,iphone7plus,iphone8plus) 177 | NavBigTitleTypeIphoneX = 1 << 3 , //在iPhoneX上使用大标题 178 | NavBigTitleTypeAll = 1 << 4 , //在所有尺寸和版本上都是用大标题 179 | NavBigTitleTypePlusOrX = NavBigTitleTypePlus | NavBigTitleTypeIphoneX , //在plus和X上使用大标题 180 | 181 | }; 182 | 183 | /** 184 | * 显示大标题后,标题移动的动画类型 185 | */ 186 | typedef NS_ENUM(NSUInteger , NavTitleAnimationType) { 187 | NavTitleAnimationTypeLeftScale = 0, //从左边缩放 188 | NavTitleAnimationTypeCenterScale = 1 , //从中间缩放 189 | NavTitleAnimationTypeSmoothFade = 2, //流畅的动画 190 | NavTitleAnimationTypeStiffFade = 3 , //僵硬的动画 191 | }; 192 | 193 | 194 | @interface EasyNavigationUtils : NSObject 195 | 196 | 197 | //根据颜色创建一个图片 198 | + (UIImage *)createImageWithColor:(UIColor *)color ; 199 | 200 | // 改变图片的颜色 201 | + (UIImage *) imageWithTintColor:(UIImage *)image color:(UIColor *)tintColor ; 202 | 203 | //调整图片大小 204 | + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size ; 205 | @end 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /EasyNavigation/EasyNavigationButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyNavigationButton.m 3 | // EFDoctorHealth 4 | // 5 | // Created by nf on 2017/12/28. 6 | // Copyright © 2017年 NF. All rights reserved. 7 | // 8 | 9 | #import "EasyNavigationButton.h" 10 | #import "EasyNavigationOptions.h" 11 | #import "EasyNavigationUtils.h" 12 | #import "UIView+EasyNavigationExt.h" 13 | 14 | #define kButtonImageTopEdge 5 //按钮中图片,距离按钮上下边缘的距离 15 | #define kButtonImageMaxWidth 60 //按钮中图片最大的宽度 16 | #define kButtonTitleMaxWidth 100 //按钮中文字最大的宽度 17 | 18 | @interface EasyNavigationButton() 19 | 20 | @end 21 | 22 | /** 23 | * 高度:永远是NavigationNorlmalHeight_N:44不会变化 24 | * 宽度:宽度 = 文字宽度+图片宽度(如果titleFrame,imageFrame不为0,则会根据它们直接算出。) 25 | 文字宽度会根据 26 | */ 27 | @implementation EasyNavigationButton 28 | 29 | + (instancetype)buttonWithConfig:(EasyNavigationButton *(^)(void))button 30 | { 31 | EasyNavigationButton *btn = button(); 32 | return btn ; 33 | } 34 | 35 | + (instancetype)button 36 | { 37 | return [EasyNavigationButton buttonWithType:UIButtonTypeCustom]; 38 | } 39 | 40 | - (instancetype)initWithFrame:(CGRect)frame 41 | { 42 | if (self = [super initWithFrame:frame]) { 43 | 44 | EasyNavigationOptions *options = [EasyNavigationOptions shareInstance]; 45 | 46 | [self setTitleColor:options.buttonTitleColor forState:UIControlStateNormal]; 47 | [self setTitleColor:options.buttonTitleColorHieght forState:UIControlStateHighlighted]; 48 | self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; //省略号在最右边 49 | self.imageView.contentMode = UIViewContentModeScaleAspectFit ;//imageview需要放到中间 50 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth; 51 | self.titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth ; 52 | [self.titleLabel setFont:options.buttonTitleFont] ; 53 | // self.titleLabel.numberOfLines = 0 ; 54 | // self.titleLabel.backgroundColor = [UIColor redColor]; 55 | // self.imageView.backgroundColor = [UIColor blueColor]; 56 | // self.backgroundColor = [UIColor purpleColor]; 57 | 58 | } 59 | return self ; 60 | } 61 | 62 | - (void)layoutSubviews 63 | { 64 | [super layoutSubviews]; 65 | 66 | self.imageView.frame = CGRectZero ; 67 | if (_imageName || _highImageName) { 68 | if (!(CGRectIsNull(_imageFrame) || CGRectIsEmpty(_imageFrame))) { 69 | self.imageView.frame = _imageFrame ; 70 | } 71 | else{ 72 | self.imageView.Easy_x = 0; 73 | self.imageView.Easy_y = kButtonImageTopEdge ; 74 | self.imageView.Easy_height = self.Easy_height-kButtonImageTopEdge*2 ; 75 | 76 | CGFloat imageW = self.imageView.Easy_height ; 77 | UIImage *tempImage = nil ; 78 | if (_imageName) { 79 | tempImage = [UIImage imageNamed:_imageName]; 80 | }else if (_highImageName){ 81 | tempImage = [UIImage imageNamed:_highImageName] ; 82 | }else{ 83 | NSAssert(NO, @"imageName is illegal !") ; 84 | } 85 | if (tempImage) { 86 | imageW = (tempImage.size.width*self.imageView.Easy_height)/tempImage.size.height ; 87 | if (imageW > kButtonImageMaxWidth) { 88 | imageW = kButtonImageMaxWidth ; 89 | } 90 | } 91 | 92 | self.imageView.Easy_width = imageW ; 93 | } 94 | } 95 | 96 | self.titleLabel.frame = CGRectZero ; 97 | if (_title) { 98 | if (!(CGRectIsNull(_titleFrame) || CGRectIsEmpty(_titleFrame))) { 99 | self.titleLabel.frame = _titleFrame ; 100 | } 101 | else{ 102 | self.titleLabel.Easy_x = CGRectGetMaxX(self.imageView.frame); 103 | self.titleLabel.Easy_y = 0 ; 104 | self.titleLabel.Easy_height = self.Easy_height; 105 | 106 | CGFloat titleW = [_title sizeWithAttributes:@{NSFontAttributeName: self.titleLabel.font}].width ; 107 | if (titleW > kButtonTitleMaxWidth) { 108 | titleW = kButtonTitleMaxWidth ; 109 | } 110 | self.titleLabel.Easy_width = titleW ; 111 | } 112 | } 113 | 114 | [self setFrame:CGRectMake(self.Easy_x, self.Easy_y, self.titleLabel.Easy_right, NavigationNorlmalHeight_N())] ; 115 | 116 | if (self.superview) { 117 | [self.superview setNeedsLayout]; 118 | } 119 | } 120 | 121 | - (void)setTitle:(NSString *)title 122 | { 123 | _title = title ; 124 | [self setTitle:title forState:UIControlStateNormal]; 125 | } 126 | - (void)setTitleColor:(UIColor *)titleColor 127 | { 128 | _titleColor = titleColor ; 129 | [self setTitleColor:titleColor forState:UIControlStateNormal]; 130 | [self setTitleColor:[titleColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted]; 131 | } 132 | - (void)setTitleSelectColor:(UIColor *)titleSelectColor 133 | { 134 | _titleSelectColor = titleSelectColor ; 135 | [self setTitleColor:titleSelectColor forState:UIControlStateSelected]; 136 | } 137 | - (void)setTitleFont:(UIFont *)titleFont 138 | { 139 | _titleFont = titleFont ; 140 | [self.titleLabel setFont:titleFont]; 141 | } 142 | 143 | - (void)setImageName:(NSString *)imageName 144 | { 145 | _imageName = imageName ; 146 | [self setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal]; 147 | } 148 | - (void)setHighImageName:(NSString *)highImageName 149 | { 150 | _highImageName = highImageName ; 151 | [self setImage:[UIImage imageNamed:highImageName] forState:UIControlStateHighlighted]; 152 | } 153 | - (void)setBackgroundImageName:(NSString *)backgroundImageName 154 | { 155 | _backgroundImageName = backgroundImageName ; 156 | [self setBackgroundImage:[UIImage imageNamed:backgroundImageName] forState:UIControlStateNormal]; 157 | } 158 | 159 | - (void)setTitleFrame:(CGRect)titleFrame 160 | { 161 | _titleFrame = titleFrame ; 162 | // if (!CGRectEqualToRect(self.titleLabel.frame, titleFrame)) { 163 | // [self layoutIfNeeded]; 164 | // } 165 | 166 | } 167 | - (void)setImageFrame:(CGRect)imageFrame 168 | { 169 | _imageFrame = imageFrame ; 170 | // if (!CGRectEqualToRect(self.imageView.frame, imageFrame)) { 171 | // [self layoutIfNeeded]; 172 | // } 173 | } 174 | 175 | 176 | - (EasyNavigationButton *(^)(NSString *))setTitle 177 | { 178 | return ^EasyNavigationButton *(NSString *title){ 179 | self.title = title ; 180 | return self; 181 | }; 182 | } 183 | - (EasyNavigationButton *(^)(UIColor *))setTitleColor 184 | { 185 | return ^EasyNavigationButton *(UIColor *titleColor){ 186 | self.titleColor = titleColor ; 187 | return self; 188 | }; 189 | } 190 | - (EasyNavigationButton *(^)(UIColor *))setTitleSelectColor 191 | { 192 | return ^EasyNavigationButton *(UIColor *titleSelectColor){ 193 | self.titleSelectColor = titleSelectColor ; 194 | return self; 195 | }; 196 | } 197 | - (EasyNavigationButton *(^)(UIFont *))setTitleFont 198 | { 199 | return ^EasyNavigationButton *(UIFont *titleFont){ 200 | self.titleFont = titleFont; 201 | return self; 202 | }; 203 | } 204 | 205 | - (EasyNavigationButton *(^)(NSString *))setImageName 206 | { 207 | return ^EasyNavigationButton *(NSString *imageName){ 208 | self.imageName = imageName; 209 | return self; 210 | }; 211 | } 212 | - (EasyNavigationButton *(^)(NSString *))setHighImageName 213 | { 214 | return ^EasyNavigationButton *(NSString *highImageName){ 215 | self.highImageName = highImageName; 216 | return self; 217 | }; 218 | } 219 | - (EasyNavigationButton *(^)(NSString *))setBackgroundImageName 220 | { 221 | return ^EasyNavigationButton *(NSString *backgroundImageName){ 222 | self.backgroundImageName = backgroundImageName; 223 | return self; 224 | }; 225 | } 226 | 227 | - (EasyNavigationButton *(^)(CGRect))setTitleFrame 228 | { 229 | return ^EasyNavigationButton *(CGRect titleFrame){ 230 | self.titleFrame = titleFrame; 231 | return self; 232 | }; 233 | } 234 | - (EasyNavigationButton *(^)(CGRect))setImageFrame 235 | { 236 | return ^EasyNavigationButton *(CGRect ImageFrame){ 237 | self.imageFrame = ImageFrame; 238 | return self; 239 | }; 240 | } 241 | 242 | 243 | @end 244 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | EasyNavigation Provided by [anharismail](https://github.com/anharismail) 4 | 5 | . 6 | 7 | 一款超级简单的导航条管理工具。完全自定义导航条。没有`UINavigationBar` 和 `UINavigationItem` 这两个类。完全是对`UIView`的操作。 8 | 所有操作都能一行代码,操作之间完全独立,互不影响。 9 | 10 | ![](https://img.shields.io/cocoapods/v/EasyNavigation.svg?style=flat) 11 | ![](https://img.shields.io/badge/language-ObjectiveC-orange.svg) 12 | ![](https://img.shields.io/cocoapods/v/{EasyNavigation}.svg?style=flat) 13 | ![](https://img.shields.io/badge/platform-ios-lightgrey.svg) 14 | [![](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) 15 | 16 | 17 | # 集成方法 18 | 19 | ### 手动导入 20 | 1. 将工程中的`EasyNavigation`拖入工程中 21 | 2. 包含`'EasyNavigation.h`的头文件 22 | 3. 使用: 23 | 1. 设置全局信息:`EasyNavigationOptions *options = [EasyNavigationOptions shareInstance].titleColor = [UIColor blackColor];` 24 | 2. 设置全局信息自定义:`EasyNavigationController *navVC = [[EasyNavigationController alloc]initWithRootViewController:[ViewController new]];` 25 | 3. 在当前控制器上添加一个标题:`[self.navigationView setTitle:@"我是标题"];` 26 | 4. 在当前导航条右边添加一个按钮:` [self.navigationView addRightButtonWithTitle:@"提交" clickCallBack:^(UIView *view) { NSLog(@"提交按钮被点击!");//notice:这个callback会强引用控制器,请用weakself. }];` 27 | 4. ...... 28 | 29 | ### cocoapods安装 30 | 1. 在你的podfile文件中加入这句话 `pod 'EasyNavigation','~>1.0'` 31 | 2. 包含头文件`#import ` 32 | 3. 和`手动导入`一样 33 | 34 | 35 | # 使用详解 36 | 37 | __配置全局导航栏属性__ 这一步操作可以确保每一个控制器上头都有一个自定义的导航条。 38 | 39 | * (1) 包涵头文件 40 | * (2) (可省略)改变一些导航条的全局设置,但是如果省略的就会默认使用其单例里面的设置信息 41 | * (3) 用navigationcontroller包裹controller的时候,使用EasyNavigationController。如果是tabbar的话,则tabbar的每一个item都需要使用EasyNavigationController。如果使用的xib,则需要把xib中的导航控制器改成EasyNavigationController。 42 | 43 | ``` 44 | //(1)包涵头文件 45 | #import "EasyNavigation.h" 46 | ``` 47 | ``` 48 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 49 | 50 |    //(2)(可省略)改变一些导航条的全局设置,但是如果省略的就会默认使用其单例里面的设置信息 51 |    EasyNavigationOptions *options = [EasyNavigationOptions shareInstance]; 52 | options.titleColor = [UIColor blackColor]; 53 | options.buttonTitleFont = [UIFont systemFontOfSize:18]; 54 | options.navBackgroundImage = [UIImage imageNamed:@"nav_background_image.png"]; 55 | 56 |    //(3) 用navigationcontroller包裹controller的时候,使用EasyNavigationController。如果是tabbar的话,则tabbar的每一个item都需要使用EasyNavigationController。如果使用的xib,则需要把xib中的导航控制器改成EasyNavigationController。 57 |    EasyNavigationController *navVC = [[EasyNavigationController alloc]initWithRootViewController:[ViewController new]]; 58 | self.window.rootViewController = navVC ; 59 | 60 | return YES; 61 | } 62 | ``` 63 | _【preview】_ 64 | 65 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/home@2x.png) 66 | 67 | 68 | ## 导航栏上的控件增删改操作 69 | 70 | 下面所有的操作,首先需要包含头文件 71 | `#import "EasyNavigation.h"` 72 | #### 1,添加标题 73 | ``` 74 | [self.navigationView setTitle:@"我是标题"]; 75 | //需要改变标题上的文字 76 | [self.navigationView setTitle:@"我是改变后的标题"]; 77 |  //改变标题上面的属性 78 | self.navigationView.titleLabel.font = [UIFont systemFontOfSize:12] ; 79 | self.navigationView.titleLabel.textColor = [UIColor redColor]; 80 |   81 |  //需要添加一个titleview 82 | [self.navigationView addtitleView:customView]; 83 | ``` 84 | 85 | #### 2,添加按钮 86 | 87 | ``` 88 | //添加一个文字按钮 ,可以用全局变量记下这个rightButton。在你接下来的操作中使用这个按钮, 89 | self.rightButton = [self.navigationView addRightButtonWithTitle:@"添加" clickCallBack:nil]; 90 | //在某处使用这个按钮 91 | [self.rightButton setTitle:@"改变了" forState:UIControlStateNormal]; 92 | 93 | ``` 94 | ``` 95 | //添加一个带图片的按钮,如果这个按钮只有点击事件,可以这样写,更加简洁。 96 | [self.navigationView addRightButtonWithImage:kImage(@"button_normal.png") hightImage:kImage(@"button_select.png") clickCallBack:^(UIView *view) { 97 |        NSLog(@"点击了“图片按钮按钮”"); 98 | }]; 99 | ``` 100 | ``` 101 | //添加自定义按钮(clickCallback会对self强引用) 102 | kWeakSelf(self) 103 | UIButton *addButton =[UIButton buttonWithType:UIButtonTypeCustom]; 104 | [addButton setImage:kImage(@"nav_btn_back.png") forState:UIControlStateNormal]; 105 | [addButton setTitle:@"返回" forState:UIControlStateNormal]; 106 | [self.navigationView addLeftView:addButton clickCallback:^(UIView *view) { 107 | [weakself.navigationController popViewControllerAnimated:YES]; 108 | }]; 109 | ``` 110 | 111 | #### 3,添加/移除一个左右两边视图 112 | 113 | 添加/移除左右两边的视图后,都会重新布局两边的控件。 114 | ``` 115 |  //添加视图 116 | UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 40)]; 117 | [self.navigationView addLeftView:addButton clickCallback:^(UIView *view) { 118 | NSLog(@"click on leftView !"); 119 | }]; 120 | 121 |  //移除视图 122 |  [self.navigationView removeLeftView:self.navigationView.leftButton]; 123 | ``` 124 | 125 | #### 4,添加一个view 126 | * view直接添加到导航栏上(不是两边控件)不会重新布局控件 127 | * 添加上view的frame不会受到导航条的约束。但是根据点击事件传递原理,它只会在导航条里面接受到事件。 128 | ``` 129 | __block UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100, -10, SCREEN_WIDTH-180, NAV_HEIGHT + 20)]; 130 | view.backgroundColor = [UIColor purpleColor]; 131 | [self.navigationView addSubview:view clickCallback:^(UIView *view) { 132 | [view removeFromSuperview]; 133 | }]; 134 | ``` 135 | 136 | #### 5,添加/移除导航条 137 | 138 | * 删除操作会把当前的导航条彻底重内存中删除。如果在以后还会使用建议使用` self.navigationView.hidden = YES ;`隐藏导航条 139 | * 添加操作会重新创建一个新导航条,需要自己往上面添加子控件。 140 | ``` 141 | if (self.navigationView) { 142 | [self.navigationView removeFromSuperview]; 143 | self.navigationView = nil ; 144 | } 145 | ``` 146 | ``` 147 | if (!self.navigationView) { 148 | EasyNavigationView *nav = [[EasyNavigationView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH , NAV_HEIGHT)]; 149 | [self setNavigationView:nav]; 150 | [self.view addSubview:nav]; 151 | } 152 | ``` 153 | _【preview】_ 154 | 155 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/operate.gif) 156 | 157 | 158 | 159 | ## 透明度改变 160 | 161 | #### 1,设置导航条为透明背景 162 |  ``` 163 | [self.navigationView setNavigationBackgroundAlpha:0]; 164 |     //当不想让导航条下面的细线变为透明 165 | self.navigationView.lineView.alpha = 1 ; 166 |  ``` 167 | 168 | #### 2,导航条颜色渐变 169 | ``` 170 | //self.tableView 为支持导航条渐变的scrollview, 171 | //NAV_HEIGHT为开始渐变的位置,NAV_HEIGHT*4为结束渐变的位置。在其中间的移动会均匀变化 172 | [self.navigationView navigationAlphaSlowChangeWithScrollow:self.tableView]; 173 | 174 | [self.navigationView navigationAlphaSlowChangeWithScrollow:self.tableView start:NAV_HEIGHT end:NAV_HEIGHT*4]; 175 | ``` 176 | 177 | _【preview】_ 178 | 179 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/alpha.gif) 180 | 181 | ## 导航条隐藏 182 | 183 | #### 1,无导航条 184 |  可以移除,或者隐藏导航条 185 | ``` 186 | #if 1//以下两个2选1 187 | if (self.navigationView) { 188 | [self.navigationView removeFromSuperview]; 189 | self.navigationView = nil ; 190 | } 191 | #else 192 | self.navigationView.hidden = YES ; 193 | #endif 194 | ``` 195 | 196 | 197 | #### 2,导航条随scrollview滚动而慢慢隐藏 198 | 199 | ``` 200 | //self.tableView 为支持导航条渐变的scrollview, 201 | //NAV_HEIGHT 为开始渐变self.tableView需要滚动的距离,也就是说,只有在self.tableView滚动NAV_HEIGHT后导航条才开始移动。 202 | //0.5 为导航条向上滚动的速度。(它的值为:导航条滚动距离/self.tableView滚动距离) 203 | //NO 为是否需要在statusBar下面停止。(statusBar颜色为导航条的背景) 204 | [self.navigationView navigationSmoothScroll:self.tableView start:NAV_HEIGHT speed:0.5 stopToStatusBar:NO]; 205 | ``` 206 | 207 | #### 3,导航条在scrollview滚动某个位置时以`UIView`动画隐藏 208 | ``` 209 | //self.tableView 为支持导航条渐变的scrollview, 210 | //NAV_HEIGHT 为触发导航条隐藏的点。也就是当scrollview的contentOffset.y值操作这个数的时候,导航条就会隐藏 211 | //NO 为是否需要在statusBar下面停止。(statusBar颜色为导航条的背景) 212 | [self.navigationView navigationAnimationScroll:self.tableView criticalPoint:NAV_HEIGHT stopToStatusBar:NO]; 213 | ``` 214 | 215 | 【图片】 216 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/hidden.gif) 217 | 218 | 219 | ## 导航条手势返回手势 220 | 221 | #### 1,系统返回手势 222 | 223 | ``` 224 | //是否禁止掉系统自带的侧滑返回手势,只会作用于当前控制器。无论在什么时候设置都。 225 | self.disableSlidingBackGesture = YES; 226 | ``` 227 | #### 2,自定义拖动屏幕手势返回 228 | 229 | 设置自定义手势,不要关闭系统自带的侧滑手势。 230 |    以下两个属性都可以随时变化 231 | ``` 232 | //是否开启 手势侧滑返回 233 | self.customBackGestureEnabel = YES ; 234 | //侧滑距离左边最大的距离, 235 | self.customBackGestureEdge = 100 ; 236 | ``` 237 | 238 | #### 3,嵌套scrollview返回 239 | 240 | _【preview】_ 241 | 242 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/sliding.gif) 243 | 244 | 245 | ## 状态栏改变 246 | 247 | 默认状态栏为有状态栏,并且为黑色。每一次状态栏设置只会对当前控制器有效 248 | ``` 249 | //是否隐藏状态栏 250 | self.statusBarHidden = YES ; 251 | //设置当前状态栏的样式 252 | self.statusBarStyle = UIStatusBarStyleDefault ; //UIStatusBarStyleLightContent 253 | ``` 254 | _【preview】_ 255 | 256 | ![image](https://github.com/chenliangloveyou/EasyNavigation/blob/master/nav_preview/statusBar.gif) 257 | 258 | 259 | 260 | # 注意事项 261 | ``` 262 | 这个库的原理是隐藏系统提供的导航栏,在ViewController加到导航栏控制器的桟上时加上一个自定的view作为导航栏。 263 | 加上的这个view用控制器的分类来保存。所以可以直接作为UIViewController的属性使用。 264 | ``` 265 | ``` 266 | 对侧滑控制是对导航控制器的interactivePopGestureRecognizer属性的操作。自定义侧滑是偷偷换掉这个属性的触发条件。 267 | ``` 268 | ``` 269 | 注意:由于是隐藏了系统导航栏。所以当控制器上第一个视图为scrollview的时候会向下偏移20。 270 | 需要用self.automaticallyAdjustsScrollViewInsets = NO 或者 scrollview.contentInset = UIEdgeInsetsMake(NAV_HEIGHT, 0, 0, 0)来调整视图位置。 271 | 当控制器的第一个视图不是scrollview(或子类)的时候,需要让出导航栏高度的距离。 272 | ``` 273 | ``` 274 | 注意:由于隐藏了系统导航条,只要是用EasyNavigationController为控制器的管理工具时 275 | 系统提供的UINavigationBar 和 UINavigationItem 的属性就不能使用了。 276 | ``` 277 | 278 | # 联系作者 279 | - 若果在使用过程中发现问题,请[提issue](https://github.com/chenliangloveyou/EasyShowView/issues/new)。我会及时解决。 280 | - 紧急问题可以通过邮箱:chenliangloveyou@163.com 或微信联系我。 281 | - ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/wechat_icon.png "github") 282 | - 喜欢,欢迎star~~~~ 283 | 284 | 285 | 286 | 287 | -------------------------------------------------------------------------------- /logo/horizontal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 11 | 15 | 18 | 21 | 22 | 23 | 26 | 33 | 41 | 45 | 49 | 57 | 61 | 65 | 73 | 81 | 85 | 89 | 94 | 99 | 100 | 101 | 102 | --------------------------------------------------------------------------------