├── .gitignore ├── GifAndImage ├── YNNavigationControllerScaleGif.gif └── YNNavigationControllerSliderGif.gif ├── LICENSE ├── README.md ├── YNNavigationController.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── zyn.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── YNNavigationController.xcscheme │ └── xcschememanagement.plist ├── YNNavigationController ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Demo │ ├── BaseViewController.h │ ├── BaseViewController.m │ ├── Discover(发现) │ │ ├── DiscoverGoodProduct(发现好商品) │ │ │ └── GoodShare(商品分享) │ │ │ │ ├── GoodsShareViewController.h │ │ │ │ └── GoodsShareViewController.m │ │ ├── DiscoverViewController.h │ │ └── DiscoverViewController.m │ ├── Home(首页) │ │ ├── HomeViewController.h │ │ ├── HomeViewController.m │ │ └── ProductList(商品列表) │ │ │ ├── ProductDetail(商品详情) │ │ │ ├── AddressDetail(详细地址) │ │ │ │ ├── ProductAddressDetailViewController.h │ │ │ │ └── ProductAddressDetailViewController.m │ │ │ ├── ProductDetailViewController.h │ │ │ └── ProductDetailViewController.m │ │ │ ├── ProductListViewController.h │ │ │ └── ProductListViewController.m │ ├── TestNavigationController.h │ └── TestNavigationController.m ├── Info.plist ├── Libs │ └── YNNavigationController │ │ ├── NSObject+YNAssociateObject.h │ │ ├── NSObject+YNAssociateObject.m │ │ ├── UIViewController+YNNavigationViewController.h │ │ ├── UIViewController+YNNavigationViewController.m │ │ ├── YNNavigationController.h │ │ ├── YNNavigationController.m │ │ ├── YNScreenShotView.h │ │ └── YNScreenShotView.m ├── back-@2x.png ├── back-@3x.png └── main.m └── iOSInjectionProject └── x86_64 └── identity.txt /.gitignore: -------------------------------------------------------------------------------- 1 | iOSInjectionProject/InjectionBundle.xcodeproj/project.pbxproj 2 | iOSInjectionProject/x86_64/compile_commands.sh 3 | iOSInjectionProject/BundleContents.m 4 | iOSInjectionProject/InjectionBundle-Info.plist 5 | iOSInjectionProject/InjectionBundle-Prefix.pch 6 | iOSInjectionProject/injectionCount.txt 7 | iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle/InjectionBundle 8 | iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle.dSYM/Contents/Resources/DWARF/InjectionBundle 9 | iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle 10 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/dgph 11 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-all-non-framework-target-headers.hmap 12 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-all-target-headers.hmap 13 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-generated-files.hmap 14 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-own-target-headers.hmap 15 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-project-headers.hmap 16 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle.hmap 17 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.d 18 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.dia 19 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.o 20 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/InjectionBundle.LinkFileList 21 | iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/InjectionBundle_dependency_info.dat 22 | -------------------------------------------------------------------------------- /GifAndImage/YNNavigationControllerScaleGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yongyuandouneng/YNNavigationController/e71e2029e58d41e00271cbc25dff59cc7d55515f/GifAndImage/YNNavigationControllerScaleGif.gif -------------------------------------------------------------------------------- /GifAndImage/YNNavigationControllerSliderGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yongyuandouneng/YNNavigationController/e71e2029e58d41e00271cbc25dff59cc7d55515f/GifAndImage/YNNavigationControllerSliderGif.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 yongyuandouneng 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YNNavigationController 2 | 3 | ####先上效果图 4 | 5 | ![](https://github.com/yongyuandouneng/YNNavigationController/blob/master/GifAndImage/YNNavigationControllerSliderGif.gif) 6 | ![](https://github.com/yongyuandouneng/YNNavigationController/blob/master/GifAndImage/YNNavigationControllerScaleGif.gif) 7 | 8 | 喜欢就start鼓励一下,您在使用过程中有任何问题、出现任何(BUG、Crash),请加QQ群538133294或联系我的扣扣1003580893. 9 | 10 | ####集成方法 11 | ---- 12 | 13 | 将原来的`UINavigationController`替换为`YNNavigationController`即可, 14 | 也可以采用继承YNNavigationController方式,重写里面的系统方法以及属性设置。详细见Demo. 15 | 16 | ####相关操作 17 | ---- 18 | 19 | 1.push一般会对返回按钮进行拦截,此时可以调用里面的返回动画方法yn_popViewController. 20 | 21 | 2.pop、popToVC、popToRoot这三个方法如果不需要和返回手势那个动画的话则调用原生方法,如果需要则调用与之对应的方法。 22 | 23 | 3.如果某控制器不需要手势返回则在里面写上禁止手势方法`self.yn_banRightSliderGesture = YES;` 24 | 25 | 4.如果需要隔层替换滑动手势的话则先设置`yn_resetGestureViewController = YES`,然后再赋值你要替换的层控制器类名 26 | `self.yn_resetGestureViewControllerClass = [TestViewController class]`,详情使用请看Demo. 27 | 28 | -------------------------------------------------------------------------------- /YNNavigationController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2E28B02E1D52F20300C63612 /* NSObject+YNAssociateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B02D1D52F20300C63612 /* NSObject+YNAssociateObject.m */; }; 11 | 2E28B0311D5314B600C63612 /* YNScreenShotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B0301D5314B600C63612 /* YNScreenShotView.m */; }; 12 | 2E28B0341D5314FF00C63612 /* UIViewController+YNNavigationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B0331D5314FF00C63612 /* UIViewController+YNNavigationViewController.m */; }; 13 | 2E2D39AF1D75350C00612B72 /* GoodsShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */; }; 14 | 2E3F26091D49DBA40042E303 /* TestNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E3F26081D49DBA30042E303 /* TestNavigationController.m */; }; 15 | 2E3F26101D49ED8B0042E303 /* back-@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E3F260E1D49ED8B0042E303 /* back-@2x.png */; }; 16 | 2E3F26111D49ED8B0042E303 /* back-@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E3F260F1D49ED8B0042E303 /* back-@3x.png */; }; 17 | 2E3F26181D4AF5960042E303 /* ProductAddressDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E3F26171D4AF5960042E303 /* ProductAddressDetailViewController.m */; }; 18 | 2EA092751D484ECD000C75C5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092741D484ECD000C75C5 /* main.m */; }; 19 | 2EA092781D484ECD000C75C5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092771D484ECD000C75C5 /* AppDelegate.m */; }; 20 | 2EA0927E1D484ECD000C75C5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2EA0927C1D484ECD000C75C5 /* Main.storyboard */; }; 21 | 2EA092831D484ECD000C75C5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2EA092811D484ECD000C75C5 /* LaunchScreen.storyboard */; }; 22 | 2EA092951D484F66000C75C5 /* YNNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092941D484F66000C75C5 /* YNNavigationController.m */; }; 23 | 2EA092981D4851F4000C75C5 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092971D4851F4000C75C5 /* BaseViewController.m */; }; 24 | 2EA0929E1D48586A000C75C5 /* DiscoverViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA0929D1D48586A000C75C5 /* DiscoverViewController.m */; }; 25 | 2EA092A41D485874000C75C5 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092A11D485874000C75C5 /* HomeViewController.m */; }; 26 | 2EA092A71D485C4D000C75C5 /* ProductListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092A61D485C4D000C75C5 /* ProductListViewController.m */; }; 27 | 2EA092AA1D485C5C000C75C5 /* ProductDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EA092A91D485C5C000C75C5 /* ProductDetailViewController.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 2E28B02C1D52F20300C63612 /* NSObject+YNAssociateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+YNAssociateObject.h"; sourceTree = ""; }; 32 | 2E28B02D1D52F20300C63612 /* NSObject+YNAssociateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+YNAssociateObject.m"; sourceTree = ""; }; 33 | 2E28B02F1D5314B600C63612 /* YNScreenShotView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNScreenShotView.h; sourceTree = ""; }; 34 | 2E28B0301D5314B600C63612 /* YNScreenShotView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNScreenShotView.m; sourceTree = ""; }; 35 | 2E28B0321D5314FF00C63612 /* UIViewController+YNNavigationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+YNNavigationViewController.h"; sourceTree = ""; }; 36 | 2E28B0331D5314FF00C63612 /* UIViewController+YNNavigationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+YNNavigationViewController.m"; sourceTree = ""; }; 37 | 2E2D39AD1D75350C00612B72 /* GoodsShareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoodsShareViewController.h; sourceTree = ""; }; 38 | 2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodsShareViewController.m; sourceTree = ""; }; 39 | 2E3F26071D49DBA30042E303 /* TestNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestNavigationController.h; sourceTree = ""; }; 40 | 2E3F26081D49DBA30042E303 /* TestNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestNavigationController.m; sourceTree = ""; }; 41 | 2E3F260E1D49ED8B0042E303 /* back-@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back-@2x.png"; sourceTree = ""; }; 42 | 2E3F260F1D49ED8B0042E303 /* back-@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back-@3x.png"; sourceTree = ""; }; 43 | 2E3F26161D4AF5960042E303 /* ProductAddressDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductAddressDetailViewController.h; sourceTree = ""; }; 44 | 2E3F26171D4AF5960042E303 /* ProductAddressDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductAddressDetailViewController.m; sourceTree = ""; }; 45 | 2EA092701D484ECD000C75C5 /* YNNavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YNNavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 2EA092741D484ECD000C75C5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 2EA092761D484ECD000C75C5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 2EA092771D484ECD000C75C5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 2EA0927D1D484ECD000C75C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 2EA092821D484ECD000C75C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | 2EA092841D484ECD000C75C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 2EA092931D484F66000C75C5 /* YNNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNNavigationController.h; sourceTree = ""; }; 53 | 2EA092941D484F66000C75C5 /* YNNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNNavigationController.m; sourceTree = ""; }; 54 | 2EA092961D4851F4000C75C5 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = ""; }; 55 | 2EA092971D4851F4000C75C5 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = ""; }; 56 | 2EA0929C1D48586A000C75C5 /* DiscoverViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiscoverViewController.h; sourceTree = ""; }; 57 | 2EA0929D1D48586A000C75C5 /* DiscoverViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiscoverViewController.m; sourceTree = ""; }; 58 | 2EA092A01D485874000C75C5 /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = ""; }; 59 | 2EA092A11D485874000C75C5 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = ""; }; 60 | 2EA092A51D485C4D000C75C5 /* ProductListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductListViewController.h; sourceTree = ""; }; 61 | 2EA092A61D485C4D000C75C5 /* ProductListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductListViewController.m; sourceTree = ""; }; 62 | 2EA092A81D485C5C000C75C5 /* ProductDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductDetailViewController.h; sourceTree = ""; }; 63 | 2EA092A91D485C5C000C75C5 /* ProductDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductDetailViewController.m; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 2EA0926D1D484ECD000C75C5 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 2E3F26151D4AF5830042E303 /* AddressDetail(详细地址) */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 2E3F26161D4AF5960042E303 /* ProductAddressDetailViewController.h */, 81 | 2E3F26171D4AF5960042E303 /* ProductAddressDetailViewController.m */, 82 | ); 83 | path = "AddressDetail(详细地址)"; 84 | sourceTree = ""; 85 | }; 86 | 2EA092671D484ECD000C75C5 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 2EA092721D484ECD000C75C5 /* YNNavigationController */, 90 | 2EA092711D484ECD000C75C5 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 2EA092711D484ECD000C75C5 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 2EA092701D484ECD000C75C5 /* YNNavigationController.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 2EA092721D484ECD000C75C5 /* YNNavigationController */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 2EA0928A1D484EE8000C75C5 /* Libs */, 106 | 2EA0928C1D484EF8000C75C5 /* Demo */, 107 | 2EA092761D484ECD000C75C5 /* AppDelegate.h */, 108 | 2EA092771D484ECD000C75C5 /* AppDelegate.m */, 109 | 2EA0927C1D484ECD000C75C5 /* Main.storyboard */, 110 | 2EA092811D484ECD000C75C5 /* LaunchScreen.storyboard */, 111 | 2E3F260E1D49ED8B0042E303 /* back-@2x.png */, 112 | 2E3F260F1D49ED8B0042E303 /* back-@3x.png */, 113 | 2EA092841D484ECD000C75C5 /* Info.plist */, 114 | 2EA092731D484ECD000C75C5 /* Supporting Files */, 115 | ); 116 | path = YNNavigationController; 117 | sourceTree = ""; 118 | }; 119 | 2EA092731D484ECD000C75C5 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 2EA092741D484ECD000C75C5 /* main.m */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | 2EA0928A1D484EE8000C75C5 /* Libs */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 2EA0928B1D484EE8000C75C5 /* YNNavigationController */, 131 | ); 132 | path = Libs; 133 | sourceTree = ""; 134 | }; 135 | 2EA0928B1D484EE8000C75C5 /* YNNavigationController */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 2EA092931D484F66000C75C5 /* YNNavigationController.h */, 139 | 2EA092941D484F66000C75C5 /* YNNavigationController.m */, 140 | 2E28B02F1D5314B600C63612 /* YNScreenShotView.h */, 141 | 2E28B0301D5314B600C63612 /* YNScreenShotView.m */, 142 | 2E28B02C1D52F20300C63612 /* NSObject+YNAssociateObject.h */, 143 | 2E28B02D1D52F20300C63612 /* NSObject+YNAssociateObject.m */, 144 | 2E28B0321D5314FF00C63612 /* UIViewController+YNNavigationViewController.h */, 145 | 2E28B0331D5314FF00C63612 /* UIViewController+YNNavigationViewController.m */, 146 | ); 147 | path = YNNavigationController; 148 | sourceTree = ""; 149 | }; 150 | 2EA0928C1D484EF8000C75C5 /* Demo */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 2E3F26071D49DBA30042E303 /* TestNavigationController.h */, 154 | 2E3F26081D49DBA30042E303 /* TestNavigationController.m */, 155 | 2EA092961D4851F4000C75C5 /* BaseViewController.h */, 156 | 2EA092971D4851F4000C75C5 /* BaseViewController.m */, 157 | 2EA0929F1D485874000C75C5 /* Home(首页) */, 158 | 2EA092991D48586A000C75C5 /* Discover(发现) */, 159 | ); 160 | path = Demo; 161 | sourceTree = ""; 162 | }; 163 | 2EA092991D48586A000C75C5 /* Discover(发现) */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 2EA0929A1D48586A000C75C5 /* DiscoverGoodProduct(发现好商品) */, 167 | 2EA0929C1D48586A000C75C5 /* DiscoverViewController.h */, 168 | 2EA0929D1D48586A000C75C5 /* DiscoverViewController.m */, 169 | ); 170 | path = "Discover(发现)"; 171 | sourceTree = ""; 172 | }; 173 | 2EA0929A1D48586A000C75C5 /* DiscoverGoodProduct(发现好商品) */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 2EA0929B1D48586A000C75C5 /* GoodShare(商品分享) */, 177 | ); 178 | path = "DiscoverGoodProduct(发现好商品)"; 179 | sourceTree = ""; 180 | }; 181 | 2EA0929B1D48586A000C75C5 /* GoodShare(商品分享) */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 2E2D39AD1D75350C00612B72 /* GoodsShareViewController.h */, 185 | 2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */, 186 | ); 187 | path = "GoodShare(商品分享)"; 188 | sourceTree = ""; 189 | }; 190 | 2EA0929F1D485874000C75C5 /* Home(首页) */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | 2EA092A01D485874000C75C5 /* HomeViewController.h */, 194 | 2EA092A11D485874000C75C5 /* HomeViewController.m */, 195 | 2EA092A21D485874000C75C5 /* ProductList(商品列表) */, 196 | ); 197 | path = "Home(首页)"; 198 | sourceTree = ""; 199 | }; 200 | 2EA092A21D485874000C75C5 /* ProductList(商品列表) */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 2EA092A31D485874000C75C5 /* ProductDetail(商品详情) */, 204 | 2EA092A51D485C4D000C75C5 /* ProductListViewController.h */, 205 | 2EA092A61D485C4D000C75C5 /* ProductListViewController.m */, 206 | ); 207 | path = "ProductList(商品列表)"; 208 | sourceTree = ""; 209 | }; 210 | 2EA092A31D485874000C75C5 /* ProductDetail(商品详情) */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | 2E3F26151D4AF5830042E303 /* AddressDetail(详细地址) */, 214 | 2EA092A81D485C5C000C75C5 /* ProductDetailViewController.h */, 215 | 2EA092A91D485C5C000C75C5 /* ProductDetailViewController.m */, 216 | ); 217 | path = "ProductDetail(商品详情)"; 218 | sourceTree = ""; 219 | }; 220 | /* End PBXGroup section */ 221 | 222 | /* Begin PBXNativeTarget section */ 223 | 2EA0926F1D484ECD000C75C5 /* YNNavigationController */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 2EA092871D484ECD000C75C5 /* Build configuration list for PBXNativeTarget "YNNavigationController" */; 226 | buildPhases = ( 227 | 2EA0926C1D484ECD000C75C5 /* Sources */, 228 | 2EA0926D1D484ECD000C75C5 /* Frameworks */, 229 | 2EA0926E1D484ECD000C75C5 /* Resources */, 230 | ); 231 | buildRules = ( 232 | ); 233 | dependencies = ( 234 | ); 235 | name = YNNavigationController; 236 | productName = YNNavigationController; 237 | productReference = 2EA092701D484ECD000C75C5 /* YNNavigationController.app */; 238 | productType = "com.apple.product-type.application"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 2EA092681D484ECD000C75C5 /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastUpgradeCheck = 0730; 247 | ORGANIZATIONNAME = "Yongneng Zheng"; 248 | TargetAttributes = { 249 | 2EA0926F1D484ECD000C75C5 = { 250 | CreatedOnToolsVersion = 7.3.1; 251 | DevelopmentTeam = 68DMH86NXF; 252 | }; 253 | }; 254 | }; 255 | buildConfigurationList = 2EA0926B1D484ECD000C75C5 /* Build configuration list for PBXProject "YNNavigationController" */; 256 | compatibilityVersion = "Xcode 3.2"; 257 | developmentRegion = English; 258 | hasScannedForEncodings = 0; 259 | knownRegions = ( 260 | en, 261 | Base, 262 | ); 263 | mainGroup = 2EA092671D484ECD000C75C5; 264 | productRefGroup = 2EA092711D484ECD000C75C5 /* Products */; 265 | projectDirPath = ""; 266 | projectRoot = ""; 267 | targets = ( 268 | 2EA0926F1D484ECD000C75C5 /* YNNavigationController */, 269 | ); 270 | }; 271 | /* End PBXProject section */ 272 | 273 | /* Begin PBXResourcesBuildPhase section */ 274 | 2EA0926E1D484ECD000C75C5 /* Resources */ = { 275 | isa = PBXResourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | 2E3F26111D49ED8B0042E303 /* back-@3x.png in Resources */, 279 | 2EA092831D484ECD000C75C5 /* LaunchScreen.storyboard in Resources */, 280 | 2EA0927E1D484ECD000C75C5 /* Main.storyboard in Resources */, 281 | 2E3F26101D49ED8B0042E303 /* back-@2x.png in Resources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXResourcesBuildPhase section */ 286 | 287 | /* Begin PBXSourcesBuildPhase section */ 288 | 2EA0926C1D484ECD000C75C5 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 2EA0929E1D48586A000C75C5 /* DiscoverViewController.m in Sources */, 293 | 2E28B0311D5314B600C63612 /* YNScreenShotView.m in Sources */, 294 | 2E28B0341D5314FF00C63612 /* UIViewController+YNNavigationViewController.m in Sources */, 295 | 2E28B02E1D52F20300C63612 /* NSObject+YNAssociateObject.m in Sources */, 296 | 2EA092951D484F66000C75C5 /* YNNavigationController.m in Sources */, 297 | 2E3F26181D4AF5960042E303 /* ProductAddressDetailViewController.m in Sources */, 298 | 2EA092AA1D485C5C000C75C5 /* ProductDetailViewController.m in Sources */, 299 | 2E2D39AF1D75350C00612B72 /* GoodsShareViewController.m in Sources */, 300 | 2EA092981D4851F4000C75C5 /* BaseViewController.m in Sources */, 301 | 2EA092781D484ECD000C75C5 /* AppDelegate.m in Sources */, 302 | 2EA092751D484ECD000C75C5 /* main.m in Sources */, 303 | 2E3F26091D49DBA40042E303 /* TestNavigationController.m in Sources */, 304 | 2EA092A71D485C4D000C75C5 /* ProductListViewController.m in Sources */, 305 | 2EA092A41D485874000C75C5 /* HomeViewController.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXVariantGroup section */ 312 | 2EA0927C1D484ECD000C75C5 /* Main.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 2EA0927D1D484ECD000C75C5 /* Base */, 316 | ); 317 | name = Main.storyboard; 318 | sourceTree = ""; 319 | }; 320 | 2EA092811D484ECD000C75C5 /* LaunchScreen.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 2EA092821D484ECD000C75C5 /* Base */, 324 | ); 325 | name = LaunchScreen.storyboard; 326 | sourceTree = ""; 327 | }; 328 | /* End PBXVariantGroup section */ 329 | 330 | /* Begin XCBuildConfiguration section */ 331 | 2EA092851D484ECD000C75C5 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_ANALYZER_NONNULL = YES; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_WARN_BOOL_CONVERSION = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 343 | CLANG_WARN_EMPTY_BODY = YES; 344 | CLANG_WARN_ENUM_CONVERSION = YES; 345 | CLANG_WARN_INT_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_UNREACHABLE_CODE = YES; 348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 350 | COPY_PHASE_STRIP = NO; 351 | DEBUG_INFORMATION_FORMAT = dwarf; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | ENABLE_TESTABILITY = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_DYNAMIC_NO_PIC = NO; 356 | GCC_NO_COMMON_BLOCKS = YES; 357 | GCC_OPTIMIZATION_LEVEL = 0; 358 | GCC_PREPROCESSOR_DEFINITIONS = ( 359 | "DEBUG=1", 360 | "$(inherited)", 361 | ); 362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 369 | MTL_ENABLE_DEBUG_INFO = YES; 370 | ONLY_ACTIVE_ARCH = YES; 371 | SDKROOT = iphoneos; 372 | }; 373 | name = Debug; 374 | }; 375 | 2EA092861D484ECD000C75C5 /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ALWAYS_SEARCH_USER_PATHS = NO; 379 | CLANG_ANALYZER_NONNULL = YES; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 396 | ENABLE_NS_ASSERTIONS = NO; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 407 | MTL_ENABLE_DEBUG_INFO = NO; 408 | SDKROOT = iphoneos; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | 2EA092881D484ECD000C75C5 /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | CODE_SIGN_IDENTITY = "iPhone Developer"; 418 | INFOPLIST_FILE = YNNavigationController/Info.plist; 419 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 420 | PRODUCT_BUNDLE_IDENTIFIER = com.yn.YNNavigationController; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | }; 423 | name = Debug; 424 | }; 425 | 2EA092891D484ECD000C75C5 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 429 | CODE_SIGN_IDENTITY = "iPhone Developer"; 430 | INFOPLIST_FILE = YNNavigationController/Info.plist; 431 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 432 | PRODUCT_BUNDLE_IDENTIFIER = com.yn.YNNavigationController; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | }; 435 | name = Release; 436 | }; 437 | /* End XCBuildConfiguration section */ 438 | 439 | /* Begin XCConfigurationList section */ 440 | 2EA0926B1D484ECD000C75C5 /* Build configuration list for PBXProject "YNNavigationController" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 2EA092851D484ECD000C75C5 /* Debug */, 444 | 2EA092861D484ECD000C75C5 /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | 2EA092871D484ECD000C75C5 /* Build configuration list for PBXNativeTarget "YNNavigationController" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | 2EA092881D484ECD000C75C5 /* Debug */, 453 | 2EA092891D484ECD000C75C5 /* Release */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | /* End XCConfigurationList section */ 459 | }; 460 | rootObject = 2EA092681D484ECD000C75C5 /* Project object */; 461 | } 462 | -------------------------------------------------------------------------------- /YNNavigationController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YNNavigationController.xcodeproj/xcuserdata/zyn.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 50 | 51 | 52 | 54 | 64 | 65 | 66 | 68 | 80 | 81 | 82 | 84 | 96 | 97 | 98 | 100 | 112 | 113 | 114 | 116 | 128 | 129 | 130 | 132 | 144 | 145 | 146 | 148 | 160 | 161 | 162 | 164 | 176 | 177 | 178 | 180 | 192 | 193 | 194 | 196 | 208 | 209 | 210 | 212 | 224 | 225 | 226 | 228 | 240 | 241 | 242 | 244 | 256 | 257 | 258 | 260 | 272 | 273 | 274 | 276 | 288 | 289 | 290 | 292 | 304 | 305 | 306 | 308 | 320 | 321 | 322 | 324 | 336 | 337 | 338 | 340 | 352 | 353 | 354 | 356 | 368 | 369 | 370 | 372 | 384 | 385 | 386 | 388 | 400 | 401 | 402 | 404 | 416 | 417 | 418 | 420 | 432 | 433 | 434 | 436 | 448 | 449 | 450 | 452 | 464 | 465 | 466 | 468 | 480 | 481 | 482 | 484 | 496 | 497 | 511 | 512 | 526 | 527 | 528 | 529 | 530 | 532 | 544 | 545 | 546 | 547 | 548 | -------------------------------------------------------------------------------- /YNNavigationController.xcodeproj/xcuserdata/zyn.xcuserdatad/xcschemes/YNNavigationController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /YNNavigationController.xcodeproj/xcuserdata/zyn.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YNNavigationController.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 2EA0926F1D484ECD000C75C5 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /YNNavigationController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. 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 | -------------------------------------------------------------------------------- /YNNavigationController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "TestNavigationController.h" 11 | #import "HomeViewController.h" 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | // TestNavigationController * nav = [[TestNavigationController alloc] initWithRootViewController:[[HomeViewController alloc] init]]; 23 | // 24 | // self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 25 | // self.window.rootViewController = nav; 26 | // [self.window makeKeyAndVisible]; 27 | 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // 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. 33 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application { 46 | // 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. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /YNNavigationController/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /YNNavigationController/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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 66 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @implementation BaseViewController 12 | 13 | 14 | - (void)viewDidLoad{ 15 | 16 | [super viewDidLoad]; 17 | 18 | self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; 19 | 20 | } 21 | 22 | 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Discover(发现)/DiscoverGoodProduct(发现好商品)/GoodShare(商品分享)/GoodsShareViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GoodsShareViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/30. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface GoodsShareViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Discover(发现)/DiscoverGoodProduct(发现好商品)/GoodShare(商品分享)/GoodsShareViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GoodsShareViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/30. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "GoodsShareViewController.h" 10 | 11 | @interface GoodsShareViewController () 12 | 13 | @end 14 | 15 | @implementation GoodsShareViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | self.title = @"商品分享"; 21 | UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds]; 22 | [btn setTitle:@"点我,快点我" forState:UIControlStateNormal]; 23 | [btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside]; 24 | [self.view addSubview:btn]; 25 | } 26 | 27 | 28 | - (void)tapOnClick{ 29 | 30 | [self.navigationController popToRootViewControllerAnimated:YES]; 31 | 32 | 33 | } 34 | 35 | 36 | - (void)didReceiveMemoryWarning { 37 | [super didReceiveMemoryWarning]; 38 | // Dispose of any resources that can be recreated. 39 | } 40 | 41 | /* 42 | #pragma mark - Navigation 43 | 44 | // In a storyboard-based application, you will often want to do a little preparation before navigation 45 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 46 | // Get the new view controller using [segue destinationViewController]. 47 | // Pass the selected object to the new view controller. 48 | } 49 | */ 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Discover(发现)/DiscoverViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DiscoverViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface DiscoverViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Discover(发现)/DiscoverViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DiscoverViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "DiscoverViewController.h" 10 | #import "GoodsShareViewController.h" 11 | 12 | @interface DiscoverViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *topLabel; 15 | 16 | 17 | 18 | @end 19 | 20 | @implementation DiscoverViewController 21 | 22 | 23 | - (void)viewDidLoad{ 24 | 25 | [super viewDidLoad]; 26 | 27 | self.title = @"发现"; 28 | 29 | self.view.backgroundColor = [UIColor greenColor]; 30 | 31 | UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds]; 32 | [btn setTitle:@"点我,快点我" forState:UIControlStateNormal]; 33 | [btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside]; 34 | [self.view addSubview:btn]; 35 | 36 | 37 | 38 | 39 | } 40 | 41 | - (void)tapOnClick{ 42 | 43 | GoodsShareViewController *v= [[GoodsShareViewController alloc]init]; 44 | 45 | 46 | [self.navigationController pushViewController:v animated:YES]; 47 | 48 | 49 | 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/HomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface HomeViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/HomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "HomeViewController.h" 10 | #import "ProductListViewController.h" 11 | 12 | @interface HomeViewController () 13 | @property (weak, nonatomic) IBOutlet UILabel *timerLabel; 14 | @property (nonatomic, assign) NSInteger time; 15 | @property (nonatomic, strong) NSTimer *timer; 16 | @end 17 | 18 | @implementation HomeViewController 19 | 20 | - (void)viewDidLoad{ 21 | 22 | [super viewDidLoad]; 23 | 24 | self.title = @"首页"; 25 | 26 | [self.navigationController.navigationBar setTranslucent:NO]; 27 | 28 | NSTimer *timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(test2) userInfo:nil repeats:YES]; 29 | self.timer = timer; 30 | 31 | 32 | BOOL isHasTableView = NO; 33 | for (UIView *view in self.view.subviews) { 34 | if([view isKindOfClass:[UITableView class]]) { 35 | isHasTableView = YES; 36 | } 37 | } 38 | if (!isHasTableView) { 39 | UITableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 40 | tableview.delegate = self; 41 | tableview.dataSource = self; 42 | [self.view addSubview:tableview]; 43 | 44 | } 45 | 46 | } 47 | 48 | - (void)test2{ 49 | self.time++ ; 50 | self.timerLabel.text = [NSString stringWithFormat:@"%zd",self.time]; 51 | } 52 | 53 | #pragma mark - UITableViewDelegate UITableViewDataSource 54 | 55 | //header-height 56 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 57 | 58 | 59 | return 10; 60 | 61 | } 62 | //header-secion 63 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ 64 | 65 | return [UIView new]; 66 | } 67 | 68 | //footer-hegiht 69 | -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ 70 | return 0.00001; 71 | } 72 | 73 | //footer-section 74 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ 75 | 76 | return [UIView new]; 77 | } 78 | 79 | 80 | //sections-tableView 81 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 82 | 83 | return 10; 84 | } 85 | //rows-section 86 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 87 | 88 | return 5; 89 | } 90 | //cell-height 91 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 92 | 93 | return 44; 94 | } 95 | 96 | //cell-tableview 97 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 98 | 99 | static NSString *identifier = @"identifier"; 100 | 101 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 102 | if (!cell) { 103 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; 104 | } 105 | 106 | cell.textLabel.text = @"测试"; 107 | return cell; 108 | 109 | } 110 | //select-tableview 111 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 112 | 113 | [tableView deselectRowAtIndexPath:indexPath animated:NO]; 114 | [self.navigationController pushViewController:[[ProductListViewController alloc]init] animated:YES]; 115 | 116 | } 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductDetail(商品详情)/AddressDetail(详细地址)/ProductAddressDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProductAddressDetailViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/29. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ProductAddressDetailViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductDetail(商品详情)/AddressDetail(详细地址)/ProductAddressDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProductAddressDetailViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/29. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "ProductAddressDetailViewController.h" 10 | #import "ProductListViewController.h" 11 | #import "YNNavigationController.h" 12 | #import "HomeViewController.h" 13 | 14 | @implementation ProductAddressDetailViewController 15 | - (void)viewDidLoad{ 16 | 17 | [super viewDidLoad]; 18 | 19 | self.title = @"详细地址(已开启重置手势)"; 20 | 21 | self.view.backgroundColor = [UIColor greenColor]; 22 | 23 | 24 | UIBarButtonItem *left = [self.class barButtonItemWithImage:[UIImage imageNamed:@"back-.png"] ImageH:[UIImage imageNamed:@"back-"] target:self action:@selector(popToPre) forControlEvents:UIControlEventTouchUpInside]; 25 | self.navigationItem.leftBarButtonItem = left; 26 | 27 | UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height/ 2)]; 28 | btn.backgroundColor = [UIColor groupTableViewBackgroundColor]; 29 | [btn setTitle:@"点我,快点我 回到商品列表" forState:UIControlStateNormal]; 30 | [btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside]; 31 | [self.view addSubview:btn]; 32 | // 33 | 34 | UIButton *btn2 = [[UIButton alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height / 2, self.view.frame.size.width, self.view.frame.size.height/2)]; 35 | 36 | btn.backgroundColor = [UIColor redColor]; 37 | [btn2 setTitle:@"点我,快点我 回到首页" forState:UIControlStateNormal]; 38 | [btn2 addTarget:self action:@selector(tapOnClick2) forControlEvents:UIControlEventTouchUpInside]; 39 | [self.view addSubview:btn2]; 40 | 41 | //开启手势 42 | self.yn_resetGestureViewController = YES; 43 | 44 | //重置手势滑动ViewController 45 | self.yn_resetGestureViewControllerClass = [ProductListViewController class]; 46 | 47 | } 48 | 49 | - (void)tapOnClick{ 50 | UIViewController *VC= nil; 51 | for (UIViewController *viewController in self.navigationController.viewControllers) { 52 | if ([viewController isKindOfClass:[ProductListViewController class]]) { 53 | VC = viewController; 54 | } 55 | } 56 | if (VC) { 57 | [(YNNavigationController *)self.navigationController yn_popToViewController:VC completionBlock:nil]; 58 | }else{ 59 | [self.navigationController popViewControllerAnimated:YES]; 60 | } 61 | 62 | } 63 | 64 | - (void)tapOnClick2{ 65 | // 66 | // [(YNNavigationController *)self.navigationController yn_popToRootViewControllerWithCompletionBlock:nil]; 67 | [self.navigationController popToRootViewControllerAnimated:YES]; 68 | } 69 | 70 | - (void)popToPre{ 71 | 72 | [self tapOnClick]; 73 | 74 | } 75 | 76 | 77 | + (UIBarButtonItem*)barButtonItemWithImage:(UIImage*)imageN ImageH:(UIImage*)imageH target:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents 78 | { 79 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 80 | [btn setImage:imageN forState:UIControlStateNormal]; 81 | [btn sizeToFit]; 82 | [btn addTarget:target action:action forControlEvents:controlEvents]; 83 | return [[UIBarButtonItem alloc]initWithCustomView:btn]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductDetail(商品详情)/ProductDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProductDetailViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ProductDetailViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductDetail(商品详情)/ProductDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProductDetailViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "ProductDetailViewController.h" 10 | #import "ProductAddressDetailViewController.h" 11 | #import "YNNavigationController.h" 12 | 13 | @implementation ProductDetailViewController 14 | - (void)viewDidLoad{ 15 | 16 | [super viewDidLoad]; 17 | 18 | self.title = @"商品详情"; 19 | 20 | self.view.backgroundColor = [UIColor orangeColor]; 21 | 22 | UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds]; 23 | [btn setTitle:@"点我,快点我" forState:UIControlStateNormal]; 24 | [btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside]; 25 | [self.view addSubview:btn]; 26 | 27 | } 28 | 29 | - (void)tapOnClick{ 30 | 31 | [self.navigationController pushViewController:[[ProductAddressDetailViewController alloc]init] animated:YES]; 32 | 33 | } 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProductListViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ProductListViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductListViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProductListViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "ProductListViewController.h" 10 | #import "ProductDetailViewController.h" 11 | #import "DiscoverViewController.h" 12 | #import "TestNavigationController.h" 13 | 14 | @implementation ProductListViewController 15 | - (void)viewDidLoad{ 16 | 17 | [super viewDidLoad]; 18 | 19 | self.title = @"商品列表"; 20 | 21 | self.view.backgroundColor = [UIColor redColor]; 22 | 23 | UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds]; 24 | [btn setTitle:@"点我,快点我" forState:UIControlStateNormal]; 25 | [btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside]; 26 | [self.view addSubview:btn]; 27 | 28 | } 29 | 30 | - (void)tapOnClick{ 31 | 32 | [self.navigationController pushViewController:[[ProductDetailViewController alloc]init] animated:YES]; 33 | 34 | 35 | // DiscoverViewController * v = [[DiscoverViewController alloc]init]; 36 | // 37 | // TestNavigationController *NA = [[TestNavigationController alloc]initWithRootViewController:v]; 38 | // 39 | // [self presentViewController:NA animated:YES completion:nil]; 40 | 41 | 42 | 43 | } 44 | 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/TestNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestNavigationController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/28. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "YNNavigationController.h" 10 | 11 | @interface TestNavigationController : YNNavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YNNavigationController/Demo/TestNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestNavigationController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/28. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "TestNavigationController.h" 10 | 11 | @implementation TestNavigationController 12 | 13 | - (void)viewDidLoad{ 14 | 15 | [super viewDidLoad]; 16 | 17 | //配置属性 18 | self.shotViewAnimationType = ShotViewAnimationTypeScale; 19 | self.scaleViewFloat = 0.9; 20 | 21 | } 22 | 23 | 24 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ 25 | 26 | 27 | if (self.childViewControllers.count > 0) { 28 | viewController.hidesBottomBarWhenPushed = YES; 29 | 30 | UIBarButtonItem *left = [self.class barButtonItemWithImage:[UIImage imageNamed:@"back-.png"] ImageH:[UIImage imageNamed:@"back-"] target:self action:@selector(popToPre) forControlEvents:UIControlEventTouchUpInside]; 31 | viewController.navigationItem.leftBarButtonItem = left; 32 | } 33 | [super pushViewController:viewController animated:animated]; 34 | } 35 | 36 | - (void)popToPre{ 37 | 38 | [self yn_popViewController]; 39 | 40 | } 41 | 42 | 43 | + (UIBarButtonItem*)barButtonItemWithImage:(UIImage*)imageN ImageH:(UIImage*)imageH target:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents 44 | { 45 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 46 | [btn setImage:imageN forState:UIControlStateNormal]; 47 | [btn sizeToFit]; 48 | [btn addTarget:target action:action forControlEvents:controlEvents]; 49 | return [[UIBarButtonItem alloc]initWithCustomView:btn]; 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /YNNavigationController/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/NSObject+YNAssociateObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+YNAssociateObject.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (YNAssociateObject) 12 | 13 | - (id)yn_AssociativeObjectForKey:(NSString *)key; 14 | 15 | - (void)yn_RemoveAssociatedObjectForKey:(NSString *)key; 16 | 17 | - (void)yn_SetAssociativeObject:(id)object forKey:(NSString *)key; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/NSObject+YNAssociateObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+YNAssociateObject.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "NSObject+YNAssociateObject.h" 10 | #import 11 | 12 | 13 | @implementation NSObject (YNAssociateObject) 14 | 15 | static char associativeObjectsKey; 16 | 17 | - (id)yn_AssociativeObjectForKey:(NSString *)key 18 | { 19 | NSMutableDictionary *dict = objc_getAssociatedObject(self, &associativeObjectsKey); 20 | 21 | return [dict objectForKey:key]; 22 | } 23 | 24 | - (void)yn_RemoveAssociatedObjectForKey:(NSString *)key 25 | { 26 | NSMutableDictionary *dict = objc_getAssociatedObject(self, &associativeObjectsKey); 27 | 28 | [dict removeObjectForKey:key]; 29 | } 30 | 31 | - (void)yn_SetAssociativeObject:(id)object forKey:(NSString *)key 32 | { 33 | NSMutableDictionary *dict = objc_getAssociatedObject(self, &associativeObjectsKey); 34 | 35 | if (!dict) { 36 | dict = [NSMutableDictionary dictionary]; 37 | objc_setAssociatedObject(self, &associativeObjectsKey, dict, OBJC_ASSOCIATION_RETAIN); 38 | } 39 | 40 | if (object == nil) { 41 | [dict removeObjectForKey:key]; 42 | } else { 43 | [dict setObject:object forKey:key]; 44 | } 45 | } 46 | 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/UIViewController+YNNavigationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+YNNavigationViewController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NSObject+YNAssociateObject.h" 11 | 12 | @interface UIViewController (YNNavigationViewController) 13 | 14 | /** 是否禁止右滑手势 NO */ 15 | @property (nonatomic, assign) BOOL yn_banRightSliderGesture; 16 | 17 | /** 是否开启重置手势 开启后才能设置下面的值 默认 NO */ 18 | @property (nonatomic, assign) BOOL yn_resetGestureViewController; 19 | 20 | /** 重置手势滑动返回的上一个控制器 Class */ 21 | @property (nonatomic, assign) Class yn_resetGestureViewControllerClass; 22 | 23 | 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/UIViewController+YNNavigationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+YNNavigationViewController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+YNNavigationViewController.h" 10 | 11 | 12 | @implementation UIViewController (YNNavigationViewController) 13 | 14 | 15 | - (void)setYn_banRightSliderGesture:(BOOL)yn_banRightSliderGesture{ 16 | 17 | [self yn_SetAssociativeObject:@(yn_banRightSliderGesture) forKey:@"yn_banRightSliderGesture"]; 18 | } 19 | 20 | 21 | - (BOOL)yn_banRightSliderGesture{ 22 | 23 | return [[self yn_AssociativeObjectForKey:@"yn_banRightSliderGesture"] boolValue]; 24 | } 25 | 26 | - (void)setYn_resetGestureViewController:(BOOL)yn_resetGestureViewController{ 27 | 28 | [self yn_SetAssociativeObject:@(yn_resetGestureViewController) forKey:@"yn_resetGestureViewControllerKey"]; 29 | } 30 | 31 | - (BOOL)yn_resetGestureViewController{ 32 | 33 | return [[self yn_AssociativeObjectForKey:@"yn_resetGestureViewControllerKey"] boolValue]; 34 | } 35 | 36 | 37 | - (void)setYn_resetGestureViewControllerClass:(Class)yn_resetGestureViewControllerClass{ 38 | 39 | [self yn_SetAssociativeObject:yn_resetGestureViewControllerClass forKey:@"yn_resetGestureViewControllerClass"]; 40 | 41 | } 42 | 43 | - (Class)yn_resetGestureViewControllerClass{ 44 | 45 | return [self yn_AssociativeObjectForKey:@"yn_resetGestureViewControllerClass"]; 46 | 47 | } 48 | 49 | 50 | @end 51 | 52 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/YNNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YNNavigationController.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIViewController+YNNavigationViewController.h" 11 | #import "YNScreenShotView.h" 12 | 13 | 14 | typedef void(^AnimationCompletion)(NSArray *array); 15 | 16 | typedef NS_ENUM(NSInteger , ShotViewAnimationType) { 17 | ShotViewAnimationTypeScale = 0,//伸缩 18 | ShotViewAnimationTypeSlider = 1,//平滑 默认 19 | }; 20 | 21 | typedef NS_ENUM(NSInteger , PopViewControllerType){ 22 | 23 | PopViewControllerTypeLastViewController = 0, 24 | PopViewControllerTypeToViewController = 1, 25 | PopViewControllerTypeRootViewController = 2, 26 | 27 | }; 28 | 29 | @interface YNNavigationController : UINavigationController 30 | 31 | /** 动画类型 平滑*/ 32 | @property (nonatomic, assign) ShotViewAnimationType shotViewAnimationType; 33 | 34 | /** 是否需要遮罩 NO */ 35 | @property (nonatomic, assign) BOOL hasMaskView; 36 | 37 | /** 是否需要阴影 YES */ 38 | @property (nonatomic, assign) BOOL hasShowdow; 39 | 40 | /** 是否开启仅仅侧边滑动 NO */ 41 | @property (nonatomic, assign) BOOL onlySideGesture; 42 | 43 | /** 距离左边多少就Push 80 */ 44 | @property (nonatomic, assign) CGFloat distanceLeft; 45 | 46 | /** 蒙版的透明度 0.4 */ 47 | @property (nonatomic, assign) CGFloat maskViewAlpha; 48 | 49 | /** 缩放程度 0.95 建议在0.9 ~ 1.0*/ 50 | @property (nonatomic, assign) CGFloat scaleViewFloat; 51 | 52 | /** 动画Push Pop时间 0.3 */ 53 | @property (nonatomic, assign) CGFloat animationTime; 54 | 55 | /** popViewController */ 56 | - (void)yn_popViewController; 57 | 58 | /** popToViewController*/ 59 | - (void)yn_popToViewController:(UIViewController *)viewController completionBlock:(AnimationCompletion)animationCompletion; 60 | 61 | /** popToRootViewControllerWithCompletion 带动画回到跟控制器,但系统会默认有tabbar动画 */ 62 | - (void)yn_popToRootViewControllerWithCompletionBlock:(AnimationCompletion)animationCompletion; 63 | 64 | /** pop根方法*/ 65 | - (void)popAnimationWithPopViewControllerType:(PopViewControllerType)type toViewController:(UIViewController *)toViewController completionBlock:(AnimationCompletion)animationCompletion animated:(BOOL)animated; 66 | 67 | @end 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/YNNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YNNavigationController.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "YNNavigationController.h" 10 | #import "AppDelegate.h" 11 | 12 | 13 | #define YN_SHOTVIEW [YNScreenShotView shareInstance] 14 | #define __appDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate) 15 | #define __YNScreenWidth ([UIScreen mainScreen].bounds.size.width) 16 | #define __YNScreenHeight ([UIScreen mainScreen].bounds.size.height) 17 | 18 | 19 | @interface YNNavigationController () 20 | 21 | 22 | @end 23 | 24 | @implementation YNNavigationController 25 | 26 | 27 | - (void)viewDidLoad{ 28 | [super viewDidLoad]; 29 | 30 | self.shotViewAnimationType = ShotViewAnimationTypeSlider; 31 | self.hasMaskView = YES; 32 | self.hasShowdow = YES; 33 | self.onlySideGesture = NO; 34 | self.distanceLeft = 80; 35 | self.maskViewAlpha = 0.4; 36 | self.animationTime = 0.3; 37 | self.scaleViewFloat = 0.95; 38 | 39 | UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGesListener:)]; 40 | panGesture.delegate = self; 41 | [self.view addGestureRecognizer:panGesture]; 42 | 43 | } 44 | 45 | #pragma mark - UIPanGestureRecognizerListener 46 | 47 | - (void)panGesListener:(UIPanGestureRecognizer *)panGes{ 48 | 49 | if (self.viewControllers.count <= 1) return; 50 | UIViewController *lastViewController = [self.viewControllers lastObject]; 51 | UIView *topView = self.view; 52 | 53 | if (lastViewController.yn_resetGestureViewController) { 54 | lastViewController.yn_resetGestureViewController = NO; 55 | Class clazz = [lastViewController yn_resetGestureViewControllerClass]; 56 | if (clazz) { 57 | [self getAccurateYN_SHOTVIEW:nil class:clazz]; 58 | } 59 | } 60 | YNScreenShotView *shotView = YN_SHOTVIEW; 61 | 62 | if (panGes.state == UIGestureRecognizerStateBegan) { 63 | CGPoint pt2 = [panGes translationInView:self.view]; 64 | if (pt2.x < 0) return; 65 | [topView endEditing:YES]; 66 | if (self.hasShowdow) { 67 | topView.layer.shadowColor = [UIColor blackColor].CGColor; 68 | topView.layer.shadowOffset = CGSizeMake(-4, 0); 69 | topView.layer.shadowOpacity = 0.3; 70 | 71 | } 72 | }else if(panGes.state == UIGestureRecognizerStateChanged){ 73 | CGPoint pt = [panGes translationInView:self.view]; 74 | if (pt.x >= 10) { 75 | topView.transform = CGAffineTransformMakeTranslation(pt.x - 10, 0); 76 | 77 | shotView.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:-pt.x / __YNScreenWidth * 0.4 + self.maskViewAlpha]; 78 | 79 | if (self.shotViewAnimationType == ShotViewAnimationTypeScale) { 80 | shotView.imgView.transform = CGAffineTransformMakeScale(self.scaleViewFloat + (pt.x / __YNScreenWidth * 0.05), 0.95 + (pt.x / __YNScreenWidth * 0.05)); 81 | }else{ 82 | shotView.imgView.transform = CGAffineTransformMakeTranslation(pt.x *0.5-__YNScreenWidth/2 , 0); 83 | } 84 | } 85 | } 86 | else if (panGes.state == UIGestureRecognizerStateEnded){ 87 | CGPoint pt = [panGes translationInView:self.view]; 88 | if (pt.x >= self.distanceLeft) { 89 | 90 | [UIView animateWithDuration:self.animationTime animations:^{ 91 | topView.transform = CGAffineTransformMakeTranslation(__YNScreenWidth, 0); 92 | shotView.imgView.transform = CGAffineTransformMakeTranslation(0 , 0); 93 | shotView.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:0]; 94 | 95 | } completion:^(BOOL finished) { 96 | if (lastViewController.yn_resetGestureViewControllerClass) { 97 | UIViewController *targetVc = nil; 98 | for (UIViewController *tempVC in self.viewControllers) { 99 | if ([tempVC isKindOfClass:lastViewController.yn_resetGestureViewControllerClass]) { 100 | targetVc = tempVC; 101 | } 102 | } 103 | if (targetVc) { 104 | [self popToViewController:targetVc animated:NO]; 105 | }else{ 106 | [self popViewControllerAnimated:NO]; 107 | } 108 | }else{ 109 | [self popViewControllerAnimated:NO]; 110 | } 111 | topView.transform = CGAffineTransformIdentity; 112 | if (self.hasShowdow) { 113 | topView.layer.shadowOpacity = 0; 114 | } 115 | }]; 116 | 117 | }else{ 118 | [UIView animateWithDuration:self.animationTime animations:^{ 119 | shotView.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:self.maskViewAlpha]; 120 | topView.transform = CGAffineTransformIdentity; 121 | if (self.shotViewAnimationType == ShotViewAnimationTypeScale) { 122 | shotView.imgView.transform = CGAffineTransformMakeScale(self.scaleViewFloat,self.scaleViewFloat); 123 | }else{ 124 | shotView.imgView.transform = CGAffineTransformMakeTranslation(-200, 0); 125 | } 126 | 127 | } completion:^(BOOL finished) { 128 | shotView.imgView.transform = CGAffineTransformIdentity; 129 | if (self.hasShowdow) { 130 | topView.layer.shadowOpacity = 0; 131 | } 132 | 133 | }]; 134 | } 135 | } 136 | }; 137 | 138 | #pragma mark - UIGestureRecognizerDelegate 139 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 140 | { 141 | if ([otherGestureRecognizer isKindOfClass:NSClassFromString(@"UIScrollViewPanGestureRecognizer")] || [otherGestureRecognizer isKindOfClass:NSClassFromString(@"UIPanGestureRecognizer")] || 142 | [otherGestureRecognizer isKindOfClass:NSClassFromString(@"UITableViewWrapperView")]) 143 | { 144 | return NO; 145 | } 146 | 147 | return YES; 148 | } 149 | 150 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { 151 | 152 | if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UITableViewWrapperView")] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { 153 | return YES; 154 | } 155 | return NO; 156 | } 157 | 158 | -(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ 159 | 160 | UIViewController *viewController = [self.viewControllers lastObject]; 161 | if (viewController.yn_banRightSliderGesture) return NO; 162 | 163 | if (self.onlySideGesture) { 164 | CGPoint currentPoint = [gestureRecognizer locationInView:gestureRecognizer.view]; 165 | if (currentPoint.x> 30) { 166 | return NO; 167 | } 168 | } 169 | 170 | return YES; 171 | 172 | } 173 | 174 | #pragma mark - setter 175 | 176 | - (void)setHasMaskView:(BOOL)hasMaskView{ 177 | 178 | _hasMaskView = hasMaskView; 179 | 180 | YN_SHOTVIEW.maskView.hidden = !hasMaskView; 181 | } 182 | 183 | #pragma mark - Publick Method 184 | 185 | - (void)yn_popViewController 186 | { 187 | [self popAnimationWithPopViewControllerType:PopViewControllerTypeLastViewController toViewController:nil completionBlock:nil animated:NO]; 188 | } 189 | 190 | - (void)yn_popToViewController:(UIViewController *)viewController completionBlock:(AnimationCompletion)animationCompletion{ 191 | 192 | [self popAnimationWithPopViewControllerType:PopViewControllerTypeToViewController toViewController:viewController completionBlock:animationCompletion animated:NO]; 193 | 194 | } 195 | 196 | - (void)yn_popToRootViewControllerWithCompletionBlock:(AnimationCompletion)animationCompletion{ 197 | 198 | [self popAnimationWithPopViewControllerType:PopViewControllerTypeRootViewController toViewController:nil completionBlock:animationCompletion animated:NO]; 199 | } 200 | 201 | 202 | #pragma mark - 全屏Pop 203 | - (void)popAnimationWithPopViewControllerType:(PopViewControllerType)type toViewController:(UIViewController *)toViewController completionBlock:(AnimationCompletion)animationCompletion animated:(BOOL)animated{ 204 | 205 | if (animated) { 206 | if (type == PopViewControllerTypeRootViewController) { 207 | NSArray *array = [self popToRootViewControllerAnimated:YES]; 208 | if (animationCompletion) { 209 | animationCompletion(array); 210 | } 211 | }else if (type == PopViewControllerTypeToViewController) 212 | { 213 | NSArray *array = [self popToViewController:toViewController animated:YES]; 214 | if (animationCompletion) { 215 | animationCompletion(array); 216 | } 217 | }else if (type == PopViewControllerTypeLastViewController){ 218 | [self popViewControllerAnimated:YES]; 219 | } 220 | return; 221 | } 222 | 223 | UIView *topView = self.view; 224 | 225 | switch (type) { 226 | case PopViewControllerTypeToViewController: 227 | [self getAccurateYN_SHOTVIEW:toViewController class:nil]; 228 | break; 229 | case PopViewControllerTypeRootViewController: 230 | [self getAccurateYN_SHOTVIEW:self.viewControllers[0] class:nil]; 231 | break; 232 | default: 233 | break; 234 | } 235 | 236 | if (self.shotViewAnimationType == ShotViewAnimationTypeScale) { 237 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeScale(self.scaleViewFloat, self.scaleViewFloat); 238 | }else{ 239 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeTranslation(-200, 0); 240 | 241 | } 242 | YN_SHOTVIEW.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:self.maskViewAlpha]; 243 | [UIView animateWithDuration:self.animationTime animations:^{ 244 | 245 | if (self.shotViewAnimationType == ShotViewAnimationTypeScale) { 246 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeScale(1.0 , 1.0); 247 | }else{ 248 | 249 | YN_SHOTVIEW.imgView.transform = CGAffineTransformIdentity; 250 | } 251 | 252 | topView.transform = CGAffineTransformMakeTranslation(__YNScreenWidth, 0); 253 | 254 | YN_SHOTVIEW.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:0.0]; 255 | } completion:^(BOOL finished) { 256 | 257 | topView.transform = CGAffineTransformMakeTranslation(0, 0); 258 | 259 | if (type == PopViewControllerTypeRootViewController) { 260 | NSArray *array = [self popToRootViewControllerAnimated:NO]; 261 | if (animationCompletion) { 262 | animationCompletion(array); 263 | } 264 | }else if (type == PopViewControllerTypeToViewController) 265 | { 266 | NSArray *array = [self popToViewController:toViewController animated:NO]; 267 | if (animationCompletion) { 268 | animationCompletion(array); 269 | } 270 | }else if (type == PopViewControllerTypeLastViewController){ 271 | [self popViewControllerAnimated:NO]; 272 | } 273 | }]; 274 | } 275 | 276 | 277 | #pragma mark - 拦截push 278 | 279 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ 280 | 281 | if (self.viewControllers.count == 0) { 282 | [super pushViewController:viewController animated:animated]; 283 | return; 284 | } 285 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 286 | 287 | UIImage *cropImage = [self interaceptionImage]; 288 | 289 | [ [YNScreenShotView shareInstance].arrayScreenShots addObject:cropImage]; 290 | 291 | [YNScreenShotView shareInstance].imgView.image = cropImage; 292 | 293 | [self pushAnimationWithViewController:viewController isFullPush:YES]; 294 | 295 | }); 296 | } 297 | 298 | 299 | #pragma mark - 全屏PUSH 300 | 301 | - (void)pushAnimationWithViewController:(UIViewController *)viewController isFullPush:(BOOL)isFullPush{ 302 | 303 | [super pushViewController:viewController animated:!isFullPush]; 304 | if (isFullPush) { 305 | 306 | UIView *topView = self.view; 307 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeScale(1, 1); 308 | YN_SHOTVIEW.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:0]; 309 | 310 | topView.transform = CGAffineTransformMakeTranslation(__YNScreenWidth, 0); 311 | 312 | [UIView animateWithDuration:self.animationTime animations:^{ 313 | if (self.shotViewAnimationType == ShotViewAnimationTypeScale) { 314 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeScale(self.scaleViewFloat, self.scaleViewFloat); 315 | }else{ 316 | YN_SHOTVIEW.imgView.transform = CGAffineTransformMakeTranslation(-__YNScreenWidth/2 , 0); 317 | } 318 | topView.transform = CGAffineTransformMakeTranslation(0, 0); 319 | 320 | YN_SHOTVIEW.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:self.maskViewAlpha]; 321 | 322 | } completion:^(BOOL finished) { 323 | 324 | YN_SHOTVIEW.imgView.transform = CGAffineTransformIdentity; 325 | 326 | }]; 327 | } 328 | } 329 | 330 | #pragma mark - Private Method 331 | 332 | 333 | - (void)getAccurateYN_SHOTVIEW:(UIViewController *)viewController class:(Class)clazz{ 334 | 335 | for (NSInteger i = 0; i < self.viewControllers.count; i ++) { 336 | UIViewController *currentViewController = self.viewControllers[i]; 337 | if ([currentViewController isKindOfClass:[viewController class]] || [currentViewController isKindOfClass:clazz]) { 338 | UIImage *image = YN_SHOTVIEW.arrayScreenShots[i]; 339 | 340 | if (image) { 341 | YN_SHOTVIEW.imgView.image = image; 342 | } 343 | break; 344 | } 345 | } 346 | }; 347 | 348 | 349 | #pragma mark - CropImage 350 | 351 | - (UIImage *)interaceptionImage{ 352 | 353 | UIWindow *screenWindow = [[UIApplication sharedApplication] keyWindow]; 354 | UIGraphicsBeginImageContextWithOptions(screenWindow.frame.size, YES, 0.0); // no retina 355 | 356 | CGContextRef context = UIGraphicsGetCurrentContext(); 357 | 358 | CGContextSaveGState(context); 359 | for (UIWindow *window in [[UIApplication sharedApplication] windows]) { 360 | 361 | if(window == screenWindow) 362 | { 363 | break; 364 | }else{ 365 | [window.layer renderInContext:context]; 366 | } 367 | } 368 | 369 | if ([screenWindow respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { 370 | [screenWindow drawViewHierarchyInRect:screenWindow.bounds afterScreenUpdates:NO]; 371 | } else { 372 | [screenWindow.layer renderInContext:context]; 373 | } 374 | CGContextRestoreGState(context); 375 | UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); 376 | screenWindow.layer.contents = nil; 377 | UIGraphicsEndImageContext(); 378 | return viewImage; 379 | } 380 | 381 | #pragma mark - 拦截pop 382 | 383 | - (UIViewController *)popViewControllerAnimated:(BOOL)animated{ 384 | [YN_SHOTVIEW.arrayScreenShots removeLastObject]; 385 | UIImage *image = [YN_SHOTVIEW.arrayScreenShots lastObject]; 386 | 387 | YN_SHOTVIEW.imgView.image = image; 388 | 389 | return [super popViewControllerAnimated:animated]; 390 | 391 | } 392 | 393 | - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated{ 394 | 395 | 396 | for (int i = 0; i < self.viewControllers.count - 1; i++) { 397 | [YN_SHOTVIEW.arrayScreenShots removeLastObject]; 398 | UIImage *image = [YN_SHOTVIEW.arrayScreenShots lastObject]; 399 | 400 | YN_SHOTVIEW.imgView.image = image; 401 | 402 | } 403 | 404 | 405 | return [super popToRootViewControllerAnimated:animated]; 406 | 407 | } 408 | 409 | 410 | - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated{ 411 | 412 | NSArray *arr = [super popToViewController:viewController animated:animated]; 413 | 414 | if (YN_SHOTVIEW.arrayScreenShots.count > arr.count) 415 | { 416 | for (int i = 0; i < arr.count; i++) { 417 | [YN_SHOTVIEW.arrayScreenShots removeLastObject]; 418 | } 419 | } 420 | UIImage *image = [YN_SHOTVIEW.arrayScreenShots lastObject]; 421 | YN_SHOTVIEW.imgView.image = image; 422 | 423 | return arr; 424 | 425 | } 426 | 427 | @end 428 | 429 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/YNScreenShotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YNScreenShotView.h 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YNScreenShotView : UIView 12 | 13 | /** 图片数组*/ 14 | @property (nonatomic, strong) NSMutableArray *arrayScreenShots; 15 | /** 容器view*/ 16 | @property (nonatomic, strong) UIImageView *imgView; 17 | /** 蒙版*/ 18 | @property (nonatomic, strong) UIView *maskView; 19 | 20 | + (instancetype)shareInstance; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YNNavigationController/Libs/YNNavigationController/YNScreenShotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YNScreenShotView.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/8/4. 6 | // Copyright © 2016年 Yongneng Zheng. All rights reserved. 7 | // 8 | 9 | #import "YNScreenShotView.h" 10 | 11 | @implementation YNScreenShotView 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame{ 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | self.backgroundColor = [UIColor blackColor]; 17 | self.imgView = [[UIImageView alloc]initWithFrame:self.bounds]; 18 | self.maskView = [[UIView alloc]initWithFrame:self.bounds]; 19 | self.maskView.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0 alpha:0.4]; 20 | 21 | [self addSubview:self.imgView]; 22 | [self addSubview:self.maskView]; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)shareInstance{ 28 | static YNScreenShotView *__instance; 29 | static dispatch_once_t onceToken; 30 | if (![[UIApplication sharedApplication] delegate].window) return nil; 31 | dispatch_once(&onceToken, ^{ 32 | __instance = [[YNScreenShotView alloc]initWithFrame:[UIScreen mainScreen].bounds]; 33 | __instance.arrayScreenShots = [NSMutableArray array]; 34 | [[[UIApplication sharedApplication] delegate].window insertSubview:__instance atIndex:0]; 35 | 36 | }); 37 | return __instance; 38 | 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /YNNavigationController/back-@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yongyuandouneng/YNNavigationController/e71e2029e58d41e00271cbc25dff59cc7d55515f/YNNavigationController/back-@2x.png -------------------------------------------------------------------------------- /YNNavigationController/back-@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yongyuandouneng/YNNavigationController/e71e2029e58d41e00271cbc25dff59cc7d55515f/YNNavigationController/back-@3x.png -------------------------------------------------------------------------------- /YNNavigationController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YNNavigationController 4 | // 5 | // Created by ZYN on 16/7/27. 6 | // Copyright © 2016年 Yongneng Zheng. 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 | -------------------------------------------------------------------------------- /iOSInjectionProject/x86_64/identity.txt: -------------------------------------------------------------------------------- 1 | /Users/zyn/Library/Developer/Xcode/DerivedData/YNNavigationController-esdqudzxsgicatfedgwgqzgmmyyr/Build/Products/Debug-iphonesimulator/YNNavigationController.app 2 | iPhone Developer 3 | --------------------------------------------------------------------------------