├── .gitignore ├── LICENSE ├── README.md └── STNavigationBar ├── STNavigationBar.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── STNavigationBar ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── icon.imageset │ │ ├── Contents.json │ │ └── t4.jpg │ ├── image.imageset │ │ ├── Contents.json │ │ └── image.png │ ├── jshop_sign_navi_prize_active.imageset │ │ ├── Contents.json │ │ ├── jshop_sign_navi_prize_active@2x.png │ │ └── jshop_sign_navi_prize_active@3x.png │ ├── jshop_sign_navi_prize_inactive.imageset │ │ ├── Contents.json │ │ ├── jshop_sign_navi_prize_inactive@2x.png │ │ └── jshop_sign_navi_prize_inactive@3x.png │ ├── jshop_sign_navi_rule_active.imageset │ │ ├── Contents.json │ │ ├── jshop_sign_navi_rule_active@2x.png │ │ └── jshop_sign_navi_rule_active@3x.png │ ├── jshop_sign_navi_rule_normal.imageset │ │ ├── Contents.json │ │ ├── jshop_sign_navi_rule_normal@2x.png │ │ └── jshop_sign_navi_rule_normal@3x.png │ └── 客路旅行 │ │ ├── Back_Arrow.imageset │ │ ├── Back_Arrow.png │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── backArrow.imageset │ │ ├── Contents.json │ │ └── backArrow.png │ │ └── xianggang.imageset │ │ ├── Contents.json │ │ └── xianggang.jpg ├── Base.lproj │ └── LaunchScreen.storyboard ├── BookNavController.h ├── BookNavController.m ├── Info.plist ├── STConfig.h ├── STConst.h ├── STConst.m ├── STUI.h ├── STUI.m ├── TravelNav0Controller.h ├── TravelNav0Controller.m ├── TravelNav1Controller.h ├── TravelNav1Controller.m ├── TravelNavController.h ├── TravelNavController.m ├── UINavigationBar+ST.h ├── UINavigationBar+ST.m ├── UIView+ST.h ├── UIView+ST.m └── main.m ├── STNavigationBarTests ├── Info.plist └── STNavigationBarTests.m └── STNavigationBarUITests ├── Info.plist └── STNavigationBarUITests.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 沈天 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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STNavigationBar 2 | UINavigationBar的扩展使用。欢迎大家互相学习,感觉不错给个星星。 3 | ## 客路旅行Demo 4 | --- 5 | #### 1.按钮改变 6 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STNavigationBar/git0.gif) 7 | #### 2.按钮和标题改变 8 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STNavigationBar/git1.gif) 9 | #### 3.UINavigationBar动画 10 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STNavigationBar/git2.gif) 11 | --- 12 | ## 简书Demo 13 | #### 1.头像的位置改变([思路仿照标哥](https://github.com/CoderJackyHuang/NavigationBarScaleViewDemo)) 14 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STNavigationBar/git3.gif) 15 | 16 | 其他的APP的UINavigationBar效果之后将会填上 17 | 18 | 19 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6700A0CF1CDAE562004C0D5A /* BookNavController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6700A0CE1CDAE562004C0D5A /* BookNavController.m */; }; 11 | 676130521CD993F50022EBC9 /* TravelNavController.m in Sources */ = {isa = PBXBuildFile; fileRef = 676130511CD993F50022EBC9 /* TravelNavController.m */; }; 12 | 676130571CD9AA930022EBC9 /* UINavigationBar+ST.m in Sources */ = {isa = PBXBuildFile; fileRef = 676130561CD9AA930022EBC9 /* UINavigationBar+ST.m */; }; 13 | 6761305A1CD9AB460022EBC9 /* TravelNav0Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 676130591CD9AB460022EBC9 /* TravelNav0Controller.m */; }; 14 | 6761305D1CD9B4410022EBC9 /* TravelNav1Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 6761305C1CD9B4410022EBC9 /* TravelNav1Controller.m */; }; 15 | 7731D73B1CD8ADE000562F02 /* STConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 7731D7361CD8ADE000562F02 /* STConst.m */; }; 16 | 7731D73C1CD8ADE000562F02 /* STUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 7731D7381CD8ADE000562F02 /* STUI.m */; }; 17 | 7731D73D1CD8ADE000562F02 /* UIView+ST.m in Sources */ = {isa = PBXBuildFile; fileRef = 7731D73A1CD8ADE000562F02 /* UIView+ST.m */; }; 18 | 77A807591C0202F000FB59D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A807581C0202F000FB59D5 /* main.m */; }; 19 | 77A8075C1C0202F000FB59D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A8075B1C0202F000FB59D5 /* AppDelegate.m */; }; 20 | 77A807641C0202F000FB59D5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 77A807631C0202F000FB59D5 /* Assets.xcassets */; }; 21 | 77A807671C0202F000FB59D5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 77A807651C0202F000FB59D5 /* LaunchScreen.storyboard */; }; 22 | 77A807721C0202F000FB59D5 /* STNavigationBarTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A807711C0202F000FB59D5 /* STNavigationBarTests.m */; }; 23 | 77A8077D1C0202F000FB59D5 /* STNavigationBarUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A8077C1C0202F000FB59D5 /* STNavigationBarUITests.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 77A8076E1C0202F000FB59D5 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 77A8074C1C0202F000FB59D5 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 77A807531C0202F000FB59D5; 32 | remoteInfo = STNavigationBar; 33 | }; 34 | 77A807791C0202F000FB59D5 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 77A8074C1C0202F000FB59D5 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 77A807531C0202F000FB59D5; 39 | remoteInfo = STNavigationBar; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 6700A0CD1CDAE562004C0D5A /* BookNavController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BookNavController.h; sourceTree = ""; }; 45 | 6700A0CE1CDAE562004C0D5A /* BookNavController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BookNavController.m; sourceTree = ""; }; 46 | 676130501CD993F40022EBC9 /* TravelNavController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TravelNavController.h; sourceTree = ""; }; 47 | 676130511CD993F50022EBC9 /* TravelNavController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TravelNavController.m; sourceTree = ""; }; 48 | 676130551CD9AA930022EBC9 /* UINavigationBar+ST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+ST.h"; sourceTree = ""; }; 49 | 676130561CD9AA930022EBC9 /* UINavigationBar+ST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+ST.m"; sourceTree = ""; }; 50 | 676130581CD9AB460022EBC9 /* TravelNav0Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TravelNav0Controller.h; sourceTree = ""; }; 51 | 676130591CD9AB460022EBC9 /* TravelNav0Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TravelNav0Controller.m; sourceTree = ""; }; 52 | 6761305B1CD9B4410022EBC9 /* TravelNav1Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TravelNav1Controller.h; sourceTree = ""; }; 53 | 6761305C1CD9B4410022EBC9 /* TravelNav1Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TravelNav1Controller.m; sourceTree = ""; }; 54 | 7731D7341CD8ADE000562F02 /* STConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STConfig.h; sourceTree = ""; }; 55 | 7731D7351CD8ADE000562F02 /* STConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STConst.h; sourceTree = ""; }; 56 | 7731D7361CD8ADE000562F02 /* STConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STConst.m; sourceTree = ""; }; 57 | 7731D7371CD8ADE000562F02 /* STUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STUI.h; sourceTree = ""; }; 58 | 7731D7381CD8ADE000562F02 /* STUI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STUI.m; sourceTree = ""; }; 59 | 7731D7391CD8ADE000562F02 /* UIView+ST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ST.h"; sourceTree = ""; }; 60 | 7731D73A1CD8ADE000562F02 /* UIView+ST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ST.m"; sourceTree = ""; }; 61 | 77A807541C0202F000FB59D5 /* STNavigationBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = STNavigationBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 77A807581C0202F000FB59D5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 63 | 77A8075A1C0202F000FB59D5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 64 | 77A8075B1C0202F000FB59D5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 65 | 77A807631C0202F000FB59D5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 66 | 77A807661C0202F000FB59D5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 67 | 77A807681C0202F000FB59D5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 68 | 77A8076D1C0202F000FB59D5 /* STNavigationBarTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = STNavigationBarTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 69 | 77A807711C0202F000FB59D5 /* STNavigationBarTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STNavigationBarTests.m; sourceTree = ""; }; 70 | 77A807731C0202F000FB59D5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | 77A807781C0202F000FB59D5 /* STNavigationBarUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = STNavigationBarUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | 77A8077C1C0202F000FB59D5 /* STNavigationBarUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STNavigationBarUITests.m; sourceTree = ""; }; 73 | 77A8077E1C0202F000FB59D5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 74 | /* End PBXFileReference section */ 75 | 76 | /* Begin PBXFrameworksBuildPhase section */ 77 | 77A807511C0202F000FB59D5 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | 77A8076A1C0202F000FB59D5 /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | 77A807751C0202F000FB59D5 /* Frameworks */ = { 92 | isa = PBXFrameworksBuildPhase; 93 | buildActionMask = 2147483647; 94 | files = ( 95 | ); 96 | runOnlyForDeploymentPostprocessing = 0; 97 | }; 98 | /* End PBXFrameworksBuildPhase section */ 99 | 100 | /* Begin PBXGroup section */ 101 | 6700A0CC1CDAE527004C0D5A /* 简书 */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 6700A0CD1CDAE562004C0D5A /* BookNavController.h */, 105 | 6700A0CE1CDAE562004C0D5A /* BookNavController.m */, 106 | ); 107 | name = "简书"; 108 | sourceTree = ""; 109 | }; 110 | 6761304F1CD993C40022EBC9 /* 客路旅行 */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 676130501CD993F40022EBC9 /* TravelNavController.h */, 114 | 676130511CD993F50022EBC9 /* TravelNavController.m */, 115 | 676130581CD9AB460022EBC9 /* TravelNav0Controller.h */, 116 | 676130591CD9AB460022EBC9 /* TravelNav0Controller.m */, 117 | 6761305B1CD9B4410022EBC9 /* TravelNav1Controller.h */, 118 | 6761305C1CD9B4410022EBC9 /* TravelNav1Controller.m */, 119 | ); 120 | name = "客路旅行"; 121 | sourceTree = ""; 122 | }; 123 | 676130531CD9A9D10022EBC9 /* STConfig */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 7731D7341CD8ADE000562F02 /* STConfig.h */, 127 | 7731D7351CD8ADE000562F02 /* STConst.h */, 128 | 7731D7361CD8ADE000562F02 /* STConst.m */, 129 | 7731D7371CD8ADE000562F02 /* STUI.h */, 130 | 7731D7381CD8ADE000562F02 /* STUI.m */, 131 | 7731D7391CD8ADE000562F02 /* UIView+ST.h */, 132 | 7731D73A1CD8ADE000562F02 /* UIView+ST.m */, 133 | ); 134 | name = STConfig; 135 | sourceTree = ""; 136 | }; 137 | 676130541CD9AA4D0022EBC9 /* Category */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 676130551CD9AA930022EBC9 /* UINavigationBar+ST.h */, 141 | 676130561CD9AA930022EBC9 /* UINavigationBar+ST.m */, 142 | ); 143 | name = Category; 144 | sourceTree = ""; 145 | }; 146 | 77A8074B1C0202F000FB59D5 = { 147 | isa = PBXGroup; 148 | children = ( 149 | 77A807561C0202F000FB59D5 /* STNavigationBar */, 150 | 77A807701C0202F000FB59D5 /* STNavigationBarTests */, 151 | 77A8077B1C0202F000FB59D5 /* STNavigationBarUITests */, 152 | 77A807551C0202F000FB59D5 /* Products */, 153 | ); 154 | sourceTree = ""; 155 | }; 156 | 77A807551C0202F000FB59D5 /* Products */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 77A807541C0202F000FB59D5 /* STNavigationBar.app */, 160 | 77A8076D1C0202F000FB59D5 /* STNavigationBarTests.xctest */, 161 | 77A807781C0202F000FB59D5 /* STNavigationBarUITests.xctest */, 162 | ); 163 | name = Products; 164 | sourceTree = ""; 165 | }; 166 | 77A807561C0202F000FB59D5 /* STNavigationBar */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 6700A0CC1CDAE527004C0D5A /* 简书 */, 170 | 676130541CD9AA4D0022EBC9 /* Category */, 171 | 676130531CD9A9D10022EBC9 /* STConfig */, 172 | 6761304F1CD993C40022EBC9 /* 客路旅行 */, 173 | 77A8075A1C0202F000FB59D5 /* AppDelegate.h */, 174 | 77A8075B1C0202F000FB59D5 /* AppDelegate.m */, 175 | 77A807631C0202F000FB59D5 /* Assets.xcassets */, 176 | 77A807651C0202F000FB59D5 /* LaunchScreen.storyboard */, 177 | 77A807681C0202F000FB59D5 /* Info.plist */, 178 | 77A807571C0202F000FB59D5 /* Supporting Files */, 179 | ); 180 | path = STNavigationBar; 181 | sourceTree = ""; 182 | }; 183 | 77A807571C0202F000FB59D5 /* Supporting Files */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | 77A807581C0202F000FB59D5 /* main.m */, 187 | ); 188 | name = "Supporting Files"; 189 | sourceTree = ""; 190 | }; 191 | 77A807701C0202F000FB59D5 /* STNavigationBarTests */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 77A807711C0202F000FB59D5 /* STNavigationBarTests.m */, 195 | 77A807731C0202F000FB59D5 /* Info.plist */, 196 | ); 197 | path = STNavigationBarTests; 198 | sourceTree = ""; 199 | }; 200 | 77A8077B1C0202F000FB59D5 /* STNavigationBarUITests */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 77A8077C1C0202F000FB59D5 /* STNavigationBarUITests.m */, 204 | 77A8077E1C0202F000FB59D5 /* Info.plist */, 205 | ); 206 | path = STNavigationBarUITests; 207 | sourceTree = ""; 208 | }; 209 | /* End PBXGroup section */ 210 | 211 | /* Begin PBXNativeTarget section */ 212 | 77A807531C0202F000FB59D5 /* STNavigationBar */ = { 213 | isa = PBXNativeTarget; 214 | buildConfigurationList = 77A807811C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBar" */; 215 | buildPhases = ( 216 | 77A807501C0202F000FB59D5 /* Sources */, 217 | 77A807511C0202F000FB59D5 /* Frameworks */, 218 | 77A807521C0202F000FB59D5 /* Resources */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | ); 224 | name = STNavigationBar; 225 | productName = STNavigationBar; 226 | productReference = 77A807541C0202F000FB59D5 /* STNavigationBar.app */; 227 | productType = "com.apple.product-type.application"; 228 | }; 229 | 77A8076C1C0202F000FB59D5 /* STNavigationBarTests */ = { 230 | isa = PBXNativeTarget; 231 | buildConfigurationList = 77A807841C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBarTests" */; 232 | buildPhases = ( 233 | 77A807691C0202F000FB59D5 /* Sources */, 234 | 77A8076A1C0202F000FB59D5 /* Frameworks */, 235 | 77A8076B1C0202F000FB59D5 /* Resources */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | 77A8076F1C0202F000FB59D5 /* PBXTargetDependency */, 241 | ); 242 | name = STNavigationBarTests; 243 | productName = STNavigationBarTests; 244 | productReference = 77A8076D1C0202F000FB59D5 /* STNavigationBarTests.xctest */; 245 | productType = "com.apple.product-type.bundle.unit-test"; 246 | }; 247 | 77A807771C0202F000FB59D5 /* STNavigationBarUITests */ = { 248 | isa = PBXNativeTarget; 249 | buildConfigurationList = 77A807871C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBarUITests" */; 250 | buildPhases = ( 251 | 77A807741C0202F000FB59D5 /* Sources */, 252 | 77A807751C0202F000FB59D5 /* Frameworks */, 253 | 77A807761C0202F000FB59D5 /* Resources */, 254 | ); 255 | buildRules = ( 256 | ); 257 | dependencies = ( 258 | 77A8077A1C0202F000FB59D5 /* PBXTargetDependency */, 259 | ); 260 | name = STNavigationBarUITests; 261 | productName = STNavigationBarUITests; 262 | productReference = 77A807781C0202F000FB59D5 /* STNavigationBarUITests.xctest */; 263 | productType = "com.apple.product-type.bundle.ui-testing"; 264 | }; 265 | /* End PBXNativeTarget section */ 266 | 267 | /* Begin PBXProject section */ 268 | 77A8074C1C0202F000FB59D5 /* Project object */ = { 269 | isa = PBXProject; 270 | attributes = { 271 | LastUpgradeCheck = 0710; 272 | ORGANIZATIONNAME = ST; 273 | TargetAttributes = { 274 | 77A807531C0202F000FB59D5 = { 275 | CreatedOnToolsVersion = 7.1; 276 | DevelopmentTeam = Z25J3BA353; 277 | }; 278 | 77A8076C1C0202F000FB59D5 = { 279 | CreatedOnToolsVersion = 7.1; 280 | DevelopmentTeam = Z25J3BA353; 281 | TestTargetID = 77A807531C0202F000FB59D5; 282 | }; 283 | 77A807771C0202F000FB59D5 = { 284 | CreatedOnToolsVersion = 7.1; 285 | DevelopmentTeam = Z25J3BA353; 286 | TestTargetID = 77A807531C0202F000FB59D5; 287 | }; 288 | }; 289 | }; 290 | buildConfigurationList = 77A8074F1C0202F000FB59D5 /* Build configuration list for PBXProject "STNavigationBar" */; 291 | compatibilityVersion = "Xcode 3.2"; 292 | developmentRegion = English; 293 | hasScannedForEncodings = 0; 294 | knownRegions = ( 295 | en, 296 | Base, 297 | ); 298 | mainGroup = 77A8074B1C0202F000FB59D5; 299 | productRefGroup = 77A807551C0202F000FB59D5 /* Products */; 300 | projectDirPath = ""; 301 | projectRoot = ""; 302 | targets = ( 303 | 77A807531C0202F000FB59D5 /* STNavigationBar */, 304 | 77A8076C1C0202F000FB59D5 /* STNavigationBarTests */, 305 | 77A807771C0202F000FB59D5 /* STNavigationBarUITests */, 306 | ); 307 | }; 308 | /* End PBXProject section */ 309 | 310 | /* Begin PBXResourcesBuildPhase section */ 311 | 77A807521C0202F000FB59D5 /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 77A807671C0202F000FB59D5 /* LaunchScreen.storyboard in Resources */, 316 | 77A807641C0202F000FB59D5 /* Assets.xcassets in Resources */, 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | }; 320 | 77A8076B1C0202F000FB59D5 /* Resources */ = { 321 | isa = PBXResourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | 77A807761C0202F000FB59D5 /* Resources */ = { 328 | isa = PBXResourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | }; 334 | /* End PBXResourcesBuildPhase section */ 335 | 336 | /* Begin PBXSourcesBuildPhase section */ 337 | 77A807501C0202F000FB59D5 /* Sources */ = { 338 | isa = PBXSourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | 6700A0CF1CDAE562004C0D5A /* BookNavController.m in Sources */, 342 | 7731D73B1CD8ADE000562F02 /* STConst.m in Sources */, 343 | 6761305A1CD9AB460022EBC9 /* TravelNav0Controller.m in Sources */, 344 | 7731D73D1CD8ADE000562F02 /* UIView+ST.m in Sources */, 345 | 676130571CD9AA930022EBC9 /* UINavigationBar+ST.m in Sources */, 346 | 77A8075C1C0202F000FB59D5 /* AppDelegate.m in Sources */, 347 | 6761305D1CD9B4410022EBC9 /* TravelNav1Controller.m in Sources */, 348 | 77A807591C0202F000FB59D5 /* main.m in Sources */, 349 | 676130521CD993F50022EBC9 /* TravelNavController.m in Sources */, 350 | 7731D73C1CD8ADE000562F02 /* STUI.m in Sources */, 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | 77A807691C0202F000FB59D5 /* Sources */ = { 355 | isa = PBXSourcesBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | 77A807721C0202F000FB59D5 /* STNavigationBarTests.m in Sources */, 359 | ); 360 | runOnlyForDeploymentPostprocessing = 0; 361 | }; 362 | 77A807741C0202F000FB59D5 /* Sources */ = { 363 | isa = PBXSourcesBuildPhase; 364 | buildActionMask = 2147483647; 365 | files = ( 366 | 77A8077D1C0202F000FB59D5 /* STNavigationBarUITests.m in Sources */, 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | }; 370 | /* End PBXSourcesBuildPhase section */ 371 | 372 | /* Begin PBXTargetDependency section */ 373 | 77A8076F1C0202F000FB59D5 /* PBXTargetDependency */ = { 374 | isa = PBXTargetDependency; 375 | target = 77A807531C0202F000FB59D5 /* STNavigationBar */; 376 | targetProxy = 77A8076E1C0202F000FB59D5 /* PBXContainerItemProxy */; 377 | }; 378 | 77A8077A1C0202F000FB59D5 /* PBXTargetDependency */ = { 379 | isa = PBXTargetDependency; 380 | target = 77A807531C0202F000FB59D5 /* STNavigationBar */; 381 | targetProxy = 77A807791C0202F000FB59D5 /* PBXContainerItemProxy */; 382 | }; 383 | /* End PBXTargetDependency section */ 384 | 385 | /* Begin PBXVariantGroup section */ 386 | 77A807651C0202F000FB59D5 /* LaunchScreen.storyboard */ = { 387 | isa = PBXVariantGroup; 388 | children = ( 389 | 77A807661C0202F000FB59D5 /* Base */, 390 | ); 391 | name = LaunchScreen.storyboard; 392 | sourceTree = ""; 393 | }; 394 | /* End PBXVariantGroup section */ 395 | 396 | /* Begin XCBuildConfiguration section */ 397 | 77A8077F1C0202F000FB59D5 /* Debug */ = { 398 | isa = XCBuildConfiguration; 399 | buildSettings = { 400 | ALWAYS_SEARCH_USER_PATHS = NO; 401 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_CONSTANT_CONVERSION = YES; 407 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 408 | CLANG_WARN_EMPTY_BODY = YES; 409 | CLANG_WARN_ENUM_CONVERSION = YES; 410 | CLANG_WARN_INT_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_UNREACHABLE_CODE = YES; 413 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = dwarf; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | ENABLE_TESTABILITY = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu99; 420 | GCC_DYNAMIC_NO_PIC = NO; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_OPTIMIZATION_LEVEL = 0; 423 | GCC_PREPROCESSOR_DEFINITIONS = ( 424 | "DEBUG=1", 425 | "$(inherited)", 426 | ); 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 434 | MTL_ENABLE_DEBUG_INFO = YES; 435 | ONLY_ACTIVE_ARCH = YES; 436 | SDKROOT = iphoneos; 437 | TARGETED_DEVICE_FAMILY = "1,2"; 438 | }; 439 | name = Debug; 440 | }; 441 | 77A807801C0202F000FB59D5 /* Release */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ALWAYS_SEARCH_USER_PATHS = NO; 445 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 446 | CLANG_CXX_LIBRARY = "libc++"; 447 | CLANG_ENABLE_MODULES = YES; 448 | CLANG_ENABLE_OBJC_ARC = YES; 449 | CLANG_WARN_BOOL_CONVERSION = YES; 450 | CLANG_WARN_CONSTANT_CONVERSION = YES; 451 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 452 | CLANG_WARN_EMPTY_BODY = YES; 453 | CLANG_WARN_ENUM_CONVERSION = YES; 454 | CLANG_WARN_INT_CONVERSION = YES; 455 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 456 | CLANG_WARN_UNREACHABLE_CODE = YES; 457 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 458 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 459 | COPY_PHASE_STRIP = NO; 460 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 461 | ENABLE_NS_ASSERTIONS = NO; 462 | ENABLE_STRICT_OBJC_MSGSEND = YES; 463 | GCC_C_LANGUAGE_STANDARD = gnu99; 464 | GCC_NO_COMMON_BLOCKS = YES; 465 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 466 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 467 | GCC_WARN_UNDECLARED_SELECTOR = YES; 468 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 469 | GCC_WARN_UNUSED_FUNCTION = YES; 470 | GCC_WARN_UNUSED_VARIABLE = YES; 471 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 472 | MTL_ENABLE_DEBUG_INFO = NO; 473 | SDKROOT = iphoneos; 474 | TARGETED_DEVICE_FAMILY = "1,2"; 475 | VALIDATE_PRODUCT = YES; 476 | }; 477 | name = Release; 478 | }; 479 | 77A807821C0202F000FB59D5 /* Debug */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 483 | CODE_SIGN_IDENTITY = "iPhone Developer"; 484 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 485 | INFOPLIST_FILE = STNavigationBar/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = ST.MapSwift; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | PROVISIONING_PROFILE = ""; 490 | }; 491 | name = Debug; 492 | }; 493 | 77A807831C0202F000FB59D5 /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 497 | CODE_SIGN_IDENTITY = "iPhone Developer"; 498 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 499 | INFOPLIST_FILE = STNavigationBar/Info.plist; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = ST.MapSwift; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | PROVISIONING_PROFILE = ""; 504 | }; 505 | name = Release; 506 | }; 507 | 77A807851C0202F000FB59D5 /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | BUNDLE_LOADER = "$(TEST_HOST)"; 511 | INFOPLIST_FILE = STNavigationBarTests/Info.plist; 512 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 513 | PRODUCT_BUNDLE_IDENTIFIER = com.shentian.STNavigationBarTests; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/STNavigationBar.app/STNavigationBar"; 516 | }; 517 | name = Debug; 518 | }; 519 | 77A807861C0202F000FB59D5 /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | BUNDLE_LOADER = "$(TEST_HOST)"; 523 | INFOPLIST_FILE = STNavigationBarTests/Info.plist; 524 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 525 | PRODUCT_BUNDLE_IDENTIFIER = com.shentian.STNavigationBarTests; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/STNavigationBar.app/STNavigationBar"; 528 | }; 529 | name = Release; 530 | }; 531 | 77A807881C0202F000FB59D5 /* Debug */ = { 532 | isa = XCBuildConfiguration; 533 | buildSettings = { 534 | INFOPLIST_FILE = STNavigationBarUITests/Info.plist; 535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 536 | PRODUCT_BUNDLE_IDENTIFIER = com.shentian.STNavigationBarUITests; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | TEST_TARGET_NAME = STNavigationBar; 539 | USES_XCTRUNNER = YES; 540 | }; 541 | name = Debug; 542 | }; 543 | 77A807891C0202F000FB59D5 /* Release */ = { 544 | isa = XCBuildConfiguration; 545 | buildSettings = { 546 | INFOPLIST_FILE = STNavigationBarUITests/Info.plist; 547 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 548 | PRODUCT_BUNDLE_IDENTIFIER = com.shentian.STNavigationBarUITests; 549 | PRODUCT_NAME = "$(TARGET_NAME)"; 550 | TEST_TARGET_NAME = STNavigationBar; 551 | USES_XCTRUNNER = YES; 552 | }; 553 | name = Release; 554 | }; 555 | /* End XCBuildConfiguration section */ 556 | 557 | /* Begin XCConfigurationList section */ 558 | 77A8074F1C0202F000FB59D5 /* Build configuration list for PBXProject "STNavigationBar" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | 77A8077F1C0202F000FB59D5 /* Debug */, 562 | 77A807801C0202F000FB59D5 /* Release */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | 77A807811C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBar" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 77A807821C0202F000FB59D5 /* Debug */, 571 | 77A807831C0202F000FB59D5 /* Release */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | 77A807841C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBarTests" */ = { 577 | isa = XCConfigurationList; 578 | buildConfigurations = ( 579 | 77A807851C0202F000FB59D5 /* Debug */, 580 | 77A807861C0202F000FB59D5 /* Release */, 581 | ); 582 | defaultConfigurationIsVisible = 0; 583 | defaultConfigurationName = Release; 584 | }; 585 | 77A807871C0202F000FB59D5 /* Build configuration list for PBXNativeTarget "STNavigationBarUITests" */ = { 586 | isa = XCConfigurationList; 587 | buildConfigurations = ( 588 | 77A807881C0202F000FB59D5 /* Debug */, 589 | 77A807891C0202F000FB59D5 /* Release */, 590 | ); 591 | defaultConfigurationIsVisible = 0; 592 | defaultConfigurationName = Release; 593 | }; 594 | /* End XCConfigurationList section */ 595 | }; 596 | rootObject = 77A8074C1C0202F000FB59D5 /* Project object */; 597 | } 598 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 15/11/22. 6 | // Copyright © 2015年 ST. 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 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 15/11/22. 6 | // Copyright © 2015年 ST. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "TravelNavController.h" 11 | #import "TravelNav0Controller.h" 12 | #import "TravelNav1Controller.h" 13 | 14 | #import "BookNavController.h" 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; 24 | 25 | 26 | // 1.客路的 27 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[TravelNavController new]]; 28 | nav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"demo0" image:nil selectedImage:nil]; 29 | 30 | UINavigationController *nav0 = [[UINavigationController alloc]initWithRootViewController:[TravelNav0Controller new]]; 31 | nav0.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"demo1" image:nil selectedImage:nil]; 32 | UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:[TravelNav1Controller new]]; 33 | nav1.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"demo2" image:nil selectedImage:nil]; 34 | UITabBarController *tabVC = [[UITabBarController alloc]init]; 35 | tabVC.viewControllers = @[nav, nav0, nav1]; 36 | 37 | 38 | // 2.简书的 39 | UINavigationController *navBook = [[UINavigationController alloc]initWithRootViewController:[BookNavController new]]; 40 | 41 | self.window.rootViewController = navBook; 42 | [self.window makeKeyAndVisible]; 43 | 44 | return YES; 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "t4.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/icon.imageset/t4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/icon.imageset/t4.jpg -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "image.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/image.imageset/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/image.imageset/image.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_active.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jshop_sign_navi_prize_active@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "jshop_sign_navi_prize_active@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_active.imageset/jshop_sign_navi_prize_active@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_active.imageset/jshop_sign_navi_prize_active@2x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_active.imageset/jshop_sign_navi_prize_active@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_active.imageset/jshop_sign_navi_prize_active@3x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_inactive.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jshop_sign_navi_prize_inactive@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "jshop_sign_navi_prize_inactive@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_inactive.imageset/jshop_sign_navi_prize_inactive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_inactive.imageset/jshop_sign_navi_prize_inactive@2x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_inactive.imageset/jshop_sign_navi_prize_inactive@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_prize_inactive.imageset/jshop_sign_navi_prize_inactive@3x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_active.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jshop_sign_navi_rule_active@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "jshop_sign_navi_rule_active@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_active.imageset/jshop_sign_navi_rule_active@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_active.imageset/jshop_sign_navi_rule_active@2x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_active.imageset/jshop_sign_navi_rule_active@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_active.imageset/jshop_sign_navi_rule_active@3x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jshop_sign_navi_rule_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "jshop_sign_navi_rule_normal@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_normal.imageset/jshop_sign_navi_rule_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_normal.imageset/jshop_sign_navi_rule_normal@2x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_normal.imageset/jshop_sign_navi_rule_normal@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/jshop_sign_navi_rule_normal.imageset/jshop_sign_navi_rule_normal@3x.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/Back_Arrow.imageset/Back_Arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/Back_Arrow.imageset/Back_Arrow.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/Back_Arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Back_Arrow.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/backArrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "backArrow.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/backArrow.imageset/backArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/backArrow.imageset/backArrow.png -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/xianggang.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "xianggang.jpg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/xianggang.imageset/xianggang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/szlsay/STNavigationBar/271f0300f235c4fa1fbab88ce4ee3392969aa78e/STNavigationBar/STNavigationBar/Assets.xcassets/客路旅行/xianggang.imageset/xianggang.jpg -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/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 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/BookNavController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BookNavController.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/5. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BookNavController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/BookNavController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BookNavController.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/5. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "BookNavController.h" 10 | 11 | #import "STConfig.h" 12 | @interface BookNavController () 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) UIImageView *headerImageView; 15 | @property (nonatomic, assign) CGFloat iconHeight; 16 | @end 17 | 18 | @implementation BookNavController 19 | 20 | #pragma mark - --- lift cycle 生命周期 --- 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | [self.view addSubview:self.tableView]; 25 | 26 | UIView *titleView = [UIView new]; 27 | titleView.backgroundColor = [UIColor redColor]; 28 | self.navigationItem.titleView = titleView; 29 | NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(self.navigationItem.titleView.frame)); 30 | self.headerImageView.centerX = titleView.centerX; 31 | self.headerImageView.y = (STNavigationBarHeight - self.iconHeight)/2; 32 | [titleView addSubview:self.headerImageView]; 33 | } 34 | 35 | #pragma mark - --- delegate 视图委托 --- 36 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 37 | CGFloat offsetY = scrollView.contentOffset.y + scrollView.contentInset.top; 38 | // 1.拉动最大的改变距离 39 | CGFloat distance = 200; 40 | CGFloat scale = 1.0; 41 | CGFloat scaleChange = 1 - offsetY/distance; 42 | CGFloat minBar = 5; 43 | 44 | // TODO: 算法待优化 45 | if (offsetY <= 0) { // 1.下拉 46 | scale = MIN(1, scaleChange); 47 | }else { // 2.上拉 48 | scale = MAX((44 - minBar * 2) / self.iconHeight , scaleChange); 49 | } 50 | NSLog(@"%s %f %f ", __FUNCTION__, scale,offsetY); 51 | 52 | self.headerImageView.transform = CGAffineTransformMakeScale(scale, scale); 53 | // self.headerImageView.y = (STNavigationBarHeight - self.iconHeight)/2; 54 | self.headerImageView.y = -self.headerImageView.layer.cornerRadius/2; 55 | } 56 | 57 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 58 | return 20; 59 | } 60 | 61 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 62 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" 63 | forIndexPath:indexPath]; 64 | cell.textLabel.text = [NSString stringWithFormat:@"cell %ld", (long)indexPath.row]; 65 | return cell; 66 | } 67 | #pragma mark - --- event response 事件相应 --- 68 | 69 | #pragma mark - --- private methods 私有方法 --- 70 | 71 | #pragma mark - --- getters and setters 属性 --- 72 | 73 | - (UITableView *)tableView 74 | { 75 | if (!_tableView) { 76 | CGFloat tableX = 0; 77 | CGFloat tableY = 0; 78 | CGFloat tableW = ScreenWidth; 79 | CGFloat tableH = ScreenHeight - tableY; 80 | _tableView = [[UITableView alloc]initWithFrame:CGRectMake(tableX, tableY, tableW, tableH) style:UITableViewStylePlain]; 81 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 82 | _tableView.delegate = self; 83 | _tableView.dataSource = self; 84 | } 85 | return _tableView; 86 | } 87 | 88 | 89 | - (UIImageView *)headerImageView 90 | { 91 | if (!_headerImageView) { 92 | CGFloat imageX = 0; 93 | CGFloat imageY = 0; 94 | CGFloat imageW = self.iconHeight; 95 | CGFloat imageH = imageW; 96 | _headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(imageX, imageY, imageW, imageH)]; 97 | _headerImageView.image = [UIImage imageNamed:@"icon"]; 98 | _headerImageView.layer.cornerRadius = imageW/2; 99 | _headerImageView.layer.masksToBounds = YES; 100 | 101 | 102 | } 103 | return _headerImageView; 104 | } 105 | 106 | - (CGFloat)iconHeight 107 | { 108 | return 64; 109 | } 110 | 111 | //- (void)injected 112 | //{ 113 | // NSLog(@"I've been injected: %@", self); 114 | //} 115 | 116 | 117 | @end 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/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 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/STConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // STConfig.h 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #ifndef STConfig_h 10 | #define STConfig_h 11 | 12 | #import "STConst.h" 13 | #import "STUI.h" 14 | 15 | #import "UIView+ST.h" 16 | 17 | 18 | #endif /* STConfig_h */ 19 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/STConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // STConst.h 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | * 1.屏幕尺寸 12 | */ 13 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 14 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 15 | 16 | /** 17 | * 2.返回一个RGBA格式的UIColor对象 18 | */ 19 | #define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] 20 | 21 | /** 22 | * 3.返回一个RGB格式的UIColor对象 23 | */ 24 | #define RGB(r, g, b) RGBA(r, g, b, 1.0f) 25 | 26 | /** 27 | * 4.弱引用 28 | */ 29 | #define STWeakSelf __weak typeof(self) weakSelf = self; -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/STConst.m: -------------------------------------------------------------------------------- 1 | // 2 | // STConst.m 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | 10 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/STUI.h: -------------------------------------------------------------------------------- 1 | // 2 | // STUI.h 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 1.统一的较小间距 5 */ 12 | UIKIT_EXTERN CGFloat const STMarginSmall; 13 | 14 | /** 2.统一的间距 10 */ 15 | UIKIT_EXTERN CGFloat const STMargin; 16 | 17 | /** 3.统一的较大间距 16 */ 18 | UIKIT_EXTERN CGFloat const STMarginBig; 19 | 20 | /** 4.导航条的高度 44 */ 21 | UIKIT_EXTERN CGFloat const STNavigationBarHeight; 22 | 23 | /** 5.状态栏的高度 20 */ 24 | UIKIT_EXTERN CGFloat const STStatusBarHeight; 25 | 26 | 27 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/STUI.m: -------------------------------------------------------------------------------- 1 | // 2 | // STUI.m 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "STUI.h" 10 | 11 | /** 1.统一的较小间距 5*/ 12 | CGFloat const STMarginSmall = 5; 13 | 14 | /** 2.统一的间距 10*/ 15 | CGFloat const STMargin = 10; 16 | 17 | /** 3.统一的较大间距 16*/ 18 | CGFloat const STMarginBig = 16; 19 | 20 | /** 4.导航条的高度 44 */ 21 | CGFloat const STNavigationBarHeight = 44; 22 | 23 | /** 5.状态栏的高度 20 */ 24 | CGFloat const STStatusBarHeight = 20; 25 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNav0Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNav0Controller.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TravelNav0Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNav0Controller.m: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNav0Controller.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "TravelNav0Controller.h" 10 | #import "UINavigationBar+ST.h" 11 | #import "STConfig.h" 12 | @interface TravelNav0Controller () 13 | 14 | @property (nonatomic, strong) UITableView *tableView; 15 | @property (nonatomic, strong) UIImageView *imageView; 16 | @property (nonatomic, strong) UIView *navigationView; 17 | @property (nonatomic, strong) UILabel *titleView; 18 | @property (nonatomic, strong) UIButton *buttonBack; 19 | @property (nonatomic, assign) CGFloat headerHeight; 20 | @end 21 | 22 | @implementation TravelNav0Controller 23 | 24 | #pragma mark - --- lift cycle 生命周期 --- 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | [self.view addSubview:self.tableView]; 30 | 31 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.buttonBack]; 32 | self.navigationItem.titleView = self.titleView; 33 | 34 | UIView *tableHeaderView = [[UIView alloc] initWithFrame:self.imageView.bounds]; 35 | [tableHeaderView addSubview:self.imageView]; 36 | self.tableView.tableHeaderView = tableHeaderView; 37 | } 38 | 39 | - (void)viewWillAppear:(BOOL)animated 40 | { 41 | [super viewWillAppear:YES]; 42 | [self.navigationController.navigationBar setShadowImage:[UIImage new]]; 43 | } 44 | 45 | - (void)viewWillDisappear:(BOOL)animated 46 | { 47 | [super viewWillDisappear:animated]; 48 | [self.navigationController.navigationBar st_reset]; 49 | } 50 | 51 | 52 | #pragma mark - --- delegate 视图委托 --- 53 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ 54 | CGFloat offsetY = scrollView.contentInset.top + scrollView.contentOffset.y; 55 | CGFloat progress = offsetY / (self.headerHeight - 20); 56 | CGFloat progressChange = offsetY / (self.headerHeight - 64 - 44); 57 | NSLog(@"%s, %f, %f, %f", __FUNCTION__ ,progressChange, progress, offsetY); 58 | if (progress <= 0) { 59 | self.imageView.y = offsetY; 60 | self.imageView.height = self.headerHeight - offsetY; 61 | self.imageView.contentMode = UIViewContentModeScaleAspectFill; 62 | } 63 | 64 | if (progressChange >= 1) { 65 | [self.buttonBack setBackgroundImage:[UIImage imageNamed:@"backArrow"] forState:UIControlStateNormal]; 66 | self.buttonBack.alpha = (progressChange - 1); 67 | [self.navigationController.navigationBar st_setBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:(progressChange - 1)]]; 68 | self.titleView.alpha = (progressChange - 1); 69 | }else { 70 | 71 | [self.buttonBack setBackgroundImage:[UIImage imageNamed:@"Back_Arrow"] forState:UIControlStateNormal]; 72 | self.buttonBack.alpha = 1; 73 | [self.navigationController.navigationBar st_setBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:0]]; 74 | self.titleView.alpha = 0; 75 | } 76 | } 77 | 78 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 79 | return 20; 80 | } 81 | 82 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 83 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" 84 | forIndexPath:indexPath]; 85 | cell.textLabel.text = [NSString stringWithFormat:@"cell %ld", (long)indexPath.row]; 86 | return cell; 87 | } 88 | #pragma mark - --- event response 事件相应 --- 89 | 90 | #pragma mark - --- private methods 私有方法 --- 91 | 92 | #pragma mark - --- getters and setters 属性 --- 93 | 94 | - (UITableView *)tableView 95 | { 96 | if (!_tableView) { 97 | CGFloat tableX = 0; 98 | CGFloat tableY = -(STNavigationBarHeight + STStatusBarHeight); 99 | CGFloat tableW = ScreenWidth; 100 | CGFloat tableH = ScreenHeight - tableY; 101 | _tableView = [[UITableView alloc]initWithFrame:CGRectMake(tableX, tableY, tableW, tableH) style:UITableViewStylePlain]; 102 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 103 | _tableView.delegate = self; 104 | _tableView.dataSource = self; 105 | } 106 | return _tableView; 107 | } 108 | 109 | - (UIView *)navigationView 110 | { 111 | if (!_navigationView) { 112 | CGFloat viewX = 0; 113 | CGFloat viewY = -STStatusBarHeight; 114 | CGFloat viewW = ScreenWidth; 115 | CGFloat viewH = STNavigationBarHeight+STStatusBarHeight; 116 | _navigationView = [[UIView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 117 | } 118 | return _navigationView; 119 | } 120 | 121 | - (UIImageView *)imageView 122 | { 123 | if (!_imageView) { 124 | CGFloat viewX = 0; 125 | CGFloat viewY = 0; 126 | CGFloat viewW = ScreenWidth; 127 | CGFloat viewH = self.headerHeight; 128 | _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 129 | _imageView.image = [UIImage imageNamed:@"xianggang"]; 130 | [_imageView.layer setMasksToBounds:YES]; 131 | } 132 | return _imageView; 133 | } 134 | 135 | - (UIButton *)buttonBack 136 | { 137 | if (!_buttonBack) { 138 | CGFloat viewX = 0; 139 | CGFloat viewY = 0; 140 | CGFloat viewW = 13; 141 | CGFloat viewH = 21; 142 | _buttonBack = [[UIButton alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 143 | } 144 | return _buttonBack; 145 | } 146 | 147 | - (UILabel *)titleView 148 | { 149 | if (!_titleView) { 150 | CGFloat viewX = 0; 151 | CGFloat viewY = 0; 152 | CGFloat viewW = 0; 153 | CGFloat viewH = 44; 154 | _titleView = [[UILabel alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 155 | _titleView.text = @"香港"; 156 | [_titleView sizeToFit]; 157 | } 158 | return _titleView; 159 | } 160 | 161 | - (CGFloat)headerHeight 162 | { 163 | return ScreenWidth / 2; 164 | } 165 | 166 | 167 | @end 168 | 169 | 170 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNav1Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNav1Controller.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TravelNav1Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNav1Controller.m: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNav1Controller.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "TravelNav1Controller.h" 10 | 11 | #import "STConfig.h" 12 | @interface TravelNav1Controller () 13 | 14 | @property (nonatomic, strong) UITableView *tableView; 15 | @property (nonatomic, strong) UIImageView *imageView; 16 | @property (nonatomic, strong) UIView *navigationView; 17 | @property (nonatomic, strong) UILabel *titleView; 18 | @property (nonatomic, strong) UIButton *buttonBack; 19 | @property (nonatomic, assign) CGFloat headerHeight; 20 | @end 21 | 22 | @implementation TravelNav1Controller 23 | 24 | #pragma mark - --- lift cycle 生命周期 --- 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | [self.view addSubview:self.tableView]; 30 | 31 | // 1.去掉背景图片和底部线条 32 | [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; 33 | [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; 34 | 35 | [self.navigationController.navigationBar addSubview:self.navigationView]; 36 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.buttonBack]; 37 | 38 | UIView *tableHeaderView = [[UIView alloc] initWithFrame:self.imageView.bounds]; 39 | [tableHeaderView addSubview:self.imageView]; 40 | self.tableView.tableHeaderView = tableHeaderView; 41 | 42 | } 43 | #pragma mark - --- delegate 视图委托 --- 44 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ 45 | CGFloat offsetY = scrollView.contentInset.top + scrollView.contentOffset.y; 46 | CGFloat progress = offsetY / (self.headerHeight - 20); 47 | CGFloat progressChange = offsetY / (self.headerHeight - 64*2); 48 | NSLog(@"%s, %f, %f, %f", __FUNCTION__ ,progressChange, progress, offsetY); 49 | if (progress <= 0) { 50 | self.imageView.y = offsetY; 51 | self.imageView.height = self.headerHeight - offsetY; 52 | self.imageView.contentMode = UIViewContentModeScaleAspectFill; 53 | } 54 | 55 | if (progressChange >= 1) { 56 | 57 | [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ 58 | self.navigationView.y = - STStatusBarHeight; 59 | } completion:^(BOOL finished) { 60 | }]; 61 | }else { 62 | 63 | [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ 64 | self.navigationView.y = - (STNavigationBarHeight + STStatusBarHeight * 2); 65 | } completion:^(BOOL finished) { 66 | }]; 67 | } 68 | } 69 | 70 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 71 | return 20; 72 | } 73 | 74 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 75 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" 76 | forIndexPath:indexPath]; 77 | cell.textLabel.text = [NSString stringWithFormat:@"cell %ld", (long)indexPath.row]; 78 | return cell; 79 | } 80 | #pragma mark - --- event response 事件相应 --- 81 | 82 | #pragma mark - --- private methods 私有方法 --- 83 | 84 | #pragma mark - --- getters and setters 属性 --- 85 | 86 | - (UITableView *)tableView 87 | { 88 | if (!_tableView) { 89 | CGFloat tableX = 0; 90 | CGFloat tableY = -(STNavigationBarHeight + STStatusBarHeight); 91 | CGFloat tableW = ScreenWidth; 92 | CGFloat tableH = ScreenHeight - tableY; 93 | _tableView = [[UITableView alloc]initWithFrame:CGRectMake(tableX, tableY, tableW, tableH) style:UITableViewStylePlain]; 94 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 95 | _tableView.delegate = self; 96 | _tableView.dataSource = self; 97 | } 98 | return _tableView; 99 | } 100 | 101 | - (UIView *)navigationView 102 | { 103 | if (!_navigationView) { 104 | CGFloat viewX = 0; 105 | CGFloat viewY = - (STNavigationBarHeight + STStatusBarHeight * 2); 106 | CGFloat viewW = ScreenWidth; 107 | CGFloat viewH = STNavigationBarHeight+STStatusBarHeight; 108 | _navigationView = [[UIView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 109 | _navigationView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.85]; 110 | [_navigationView addSubview:self.titleView]; 111 | } 112 | return _navigationView; 113 | } 114 | 115 | - (UILabel *)titleView 116 | { 117 | if (!_titleView) { 118 | CGFloat viewX = 100; 119 | CGFloat viewY = STStatusBarHeight; 120 | CGFloat viewW = ScreenWidth - 2 * viewX; 121 | CGFloat viewH = STNavigationBarHeight; 122 | _titleView = [[UILabel alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 123 | _titleView.textAlignment = NSTextAlignmentCenter; 124 | _titleView.text = @"香港"; 125 | } 126 | return _titleView; 127 | } 128 | 129 | - (UIImageView *)imageView 130 | { 131 | if (!_imageView) { 132 | CGFloat viewX = 0; 133 | CGFloat viewY = 0; 134 | CGFloat viewW = ScreenWidth; 135 | CGFloat viewH = self.headerHeight; 136 | _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 137 | _imageView.image = [UIImage imageNamed:@"xianggang"]; 138 | [_imageView.layer setMasksToBounds:YES]; 139 | } 140 | return _imageView; 141 | } 142 | 143 | - (UIButton *)buttonBack 144 | { 145 | if (!_buttonBack) { 146 | CGFloat viewX = 0; 147 | CGFloat viewY = 0; 148 | CGFloat viewW = 13; 149 | CGFloat viewH = 21; 150 | _buttonBack = [[UIButton alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 151 | [_buttonBack setBackgroundImage:[UIImage imageNamed:@"backArrow"] forState:UIControlStateNormal]; 152 | } 153 | return _buttonBack; 154 | } 155 | 156 | - (CGFloat)headerHeight 157 | { 158 | return ScreenWidth / 2; 159 | } 160 | 161 | 162 | @end 163 | 164 | 165 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNavController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNavController.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TravelNavController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/TravelNavController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TravelNavController.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/4. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "TravelNavController.h" 10 | 11 | #import "STConfig.h" 12 | @interface TravelNavController () 13 | 14 | @property (nonatomic, strong) UITableView *tableView; 15 | @property (nonatomic, strong) UIImageView *imageView; 16 | @property (nonatomic, strong) UIView *navigationView; 17 | @property (nonatomic, strong) UIButton *buttonBack; 18 | @property (nonatomic, assign) CGFloat headerHeight; 19 | @end 20 | 21 | @implementation TravelNavController 22 | 23 | #pragma mark - --- lift cycle 生命周期 --- 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | [self.view addSubview:self.tableView]; 29 | 30 | // 1.去掉背景图片和底部线条 31 | [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; 32 | [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; 33 | 34 | [self.navigationController.navigationBar addSubview:self.navigationView]; 35 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.buttonBack]; 36 | 37 | UIView *tableHeaderView = [[UIView alloc] initWithFrame:self.imageView.bounds]; 38 | [tableHeaderView addSubview:self.imageView]; 39 | self.tableView.tableHeaderView = tableHeaderView; 40 | 41 | } 42 | #pragma mark - --- delegate 视图委托 --- 43 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ 44 | CGFloat offsetY = scrollView.contentInset.top + scrollView.contentOffset.y; 45 | CGFloat progress = offsetY / (self.headerHeight - 20); 46 | CGFloat progressChange = offsetY / (self.headerHeight - 64 - 44); 47 | NSLog(@"%s, %f, %f, %f", __FUNCTION__ ,progressChange, progress, offsetY); 48 | if (progress <= 0) { 49 | self.imageView.y = offsetY; 50 | self.imageView.height = self.headerHeight - offsetY; 51 | self.imageView.contentMode = UIViewContentModeScaleAspectFill; 52 | } 53 | 54 | if (progressChange >= 1) { 55 | self.navigationView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:(progressChange - 1)]; 56 | [self.buttonBack setBackgroundImage:[UIImage imageNamed:@"backArrow"] forState:UIControlStateNormal]; 57 | self.buttonBack.alpha = (progressChange - 1); 58 | }else { 59 | self.navigationView.backgroundColor = [UIColor clearColor]; 60 | [self.buttonBack setBackgroundImage:[UIImage imageNamed:@"Back_Arrow"] forState:UIControlStateNormal]; 61 | self.buttonBack.alpha = 1; 62 | } 63 | } 64 | 65 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 66 | return 20; 67 | } 68 | 69 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 70 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" 71 | forIndexPath:indexPath]; 72 | cell.textLabel.text = [NSString stringWithFormat:@"cell %ld", (long)indexPath.row]; 73 | return cell; 74 | } 75 | #pragma mark - --- event response 事件相应 --- 76 | 77 | #pragma mark - --- private methods 私有方法 --- 78 | 79 | #pragma mark - --- getters and setters 属性 --- 80 | 81 | - (UITableView *)tableView 82 | { 83 | if (!_tableView) { 84 | CGFloat tableX = 0; 85 | CGFloat tableY = -(STNavigationBarHeight + STStatusBarHeight); 86 | CGFloat tableW = ScreenWidth; 87 | CGFloat tableH = ScreenHeight - tableY; 88 | _tableView = [[UITableView alloc]initWithFrame:CGRectMake(tableX, tableY, tableW, tableH) style:UITableViewStylePlain]; 89 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 90 | _tableView.delegate = self; 91 | _tableView.dataSource = self; 92 | } 93 | return _tableView; 94 | } 95 | 96 | - (UIView *)navigationView 97 | { 98 | if (!_navigationView) { 99 | CGFloat viewX = 0; 100 | CGFloat viewY = -STStatusBarHeight; 101 | CGFloat viewW = ScreenWidth; 102 | CGFloat viewH = STNavigationBarHeight+STStatusBarHeight; 103 | _navigationView = [[UIView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 104 | } 105 | return _navigationView; 106 | } 107 | 108 | - (UIImageView *)imageView 109 | { 110 | if (!_imageView) { 111 | CGFloat viewX = 0; 112 | CGFloat viewY = 0; 113 | CGFloat viewW = ScreenWidth; 114 | CGFloat viewH = self.headerHeight; 115 | _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 116 | _imageView.image = [UIImage imageNamed:@"xianggang"]; 117 | [_imageView.layer setMasksToBounds:YES]; 118 | } 119 | return _imageView; 120 | } 121 | 122 | - (UIButton *)buttonBack 123 | { 124 | if (!_buttonBack) { 125 | CGFloat viewX = 0; 126 | CGFloat viewY = 0; 127 | CGFloat viewW = 13; 128 | CGFloat viewH = 21; 129 | _buttonBack = [[UIButton alloc]initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; 130 | } 131 | return _buttonBack; 132 | } 133 | 134 | - (CGFloat)headerHeight 135 | { 136 | return ScreenWidth / 2; 137 | } 138 | 139 | 140 | @end 141 | 142 | 143 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/UINavigationBar+ST.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+ST.h 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/3. 6 | // Copyright © 2016年 stebean. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationBar (ST) 12 | - (void)st_setBackgroundColor:(UIColor *)backgroundColor; 13 | - (void)st_setElementsAlpha:(CGFloat)alpha; 14 | - (void)st_setTranslationY:(CGFloat)translationY; 15 | - (void)st_reset; 16 | @end 17 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/UINavigationBar+ST.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+ST.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/5/3, Copy LTNavigationBar 6 | // Copyright © 2016年 stebean. All rights reserved. 7 | // 8 | 9 | #import "UINavigationBar+ST.h" 10 | 11 | #import 12 | 13 | @implementation UINavigationBar (ST) 14 | static char overlayKey; 15 | 16 | - (UIView *)overlay 17 | { 18 | return objc_getAssociatedObject(self, &overlayKey); 19 | } 20 | 21 | - (void)setOverlay:(UIView *)overlay 22 | { 23 | objc_setAssociatedObject(self, &overlayKey, overlay, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 24 | } 25 | 26 | - (void)st_setBackgroundColor:(UIColor *)backgroundColor 27 | { 28 | if (!self.overlay) { 29 | [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; 30 | self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)]; 31 | self.overlay.userInteractionEnabled = NO; 32 | self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth; 33 | [[self.subviews firstObject] insertSubview:self.overlay atIndex:0]; 34 | } 35 | self.overlay.backgroundColor = backgroundColor; 36 | } 37 | 38 | - (void)st_setTranslationY:(CGFloat)translationY 39 | { 40 | self.transform = CGAffineTransformMakeTranslation(0, translationY); 41 | } 42 | 43 | - (void)st_setElementsAlpha:(CGFloat)alpha 44 | { 45 | [[self valueForKey:@"_leftViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) { 46 | view.alpha = alpha; 47 | }]; 48 | 49 | [[self valueForKey:@"_rightViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) { 50 | view.alpha = alpha; 51 | }]; 52 | 53 | UIView *titleView = [self valueForKey:@"_titleView"]; 54 | titleView.alpha = alpha; 55 | // when viewController first load, the titleView maybe nil 56 | [[self subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) { 57 | if ([obj isKindOfClass:NSClassFromString(@"UINavigationItemView")]) { 58 | obj.alpha = alpha; 59 | *stop = YES; 60 | } 61 | }]; 62 | } 63 | 64 | - (void)st_reset 65 | { 66 | [self setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 67 | [self.overlay removeFromSuperview]; 68 | self.overlay = nil; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/UIView+ST.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ST.h 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (ST) 12 | /** 13 | * 1.间隔X值 14 | */ 15 | @property (nonatomic, assign) CGFloat x; 16 | 17 | /** 18 | * 2.间隔Y值 19 | */ 20 | @property (nonatomic, assign) CGFloat y; 21 | 22 | /** 23 | * 3.宽度 24 | */ 25 | @property (nonatomic, assign) CGFloat width; 26 | 27 | /** 28 | * 4.高度 29 | */ 30 | @property (nonatomic, assign) CGFloat height; 31 | 32 | /** 33 | * 5.中心点X值 34 | */ 35 | @property (nonatomic, assign) CGFloat centerX; 36 | 37 | /** 38 | * 6.中心点Y值 39 | */ 40 | @property (nonatomic, assign) CGFloat centerY; 41 | 42 | /** 43 | * 7.尺寸大小 44 | */ 45 | @property (nonatomic, assign) CGSize size; 46 | 47 | /** 48 | * 8.起始点 49 | */ 50 | @property (nonatomic, assign) CGPoint origin; 51 | 52 | /** 53 | * 9.上 < Shortcut for frame.origin.y 54 | */ 55 | @property (nonatomic) CGFloat top; 56 | 57 | /** 58 | * 10.下 < Shortcut for frame.origin.y + frame.size.height 59 | */ 60 | @property (nonatomic) CGFloat bottom; 61 | 62 | /** 63 | * 11.左 < Shortcut for frame.origin.x. 64 | */ 65 | @property (nonatomic) CGFloat left; 66 | 67 | /** 68 | * 12.右 < Shortcut for frame.origin.x + frame.size.width 69 | */ 70 | @property (nonatomic) CGFloat right; 71 | 72 | @end 73 | 74 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/UIView+ST.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ST.m 3 | // STPhotoBrowser 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 16/1/15. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "UIView+ST.h" 10 | 11 | @implementation UIView (ST) 12 | 13 | - (void)setX:(CGFloat)x 14 | { 15 | CGRect frame = self.frame; 16 | frame.origin.x = x; 17 | self.frame = frame; 18 | } 19 | 20 | - (void)setY:(CGFloat)y 21 | { 22 | CGRect frame = self.frame; 23 | frame.origin.y = y; 24 | self.frame = frame; 25 | } 26 | 27 | - (CGFloat)x 28 | { 29 | return self.frame.origin.x; 30 | } 31 | 32 | - (CGFloat)y 33 | { 34 | return self.frame.origin.y; 35 | } 36 | 37 | - (void)setWidth:(CGFloat)width 38 | { 39 | CGRect frame = self.frame; 40 | frame.size.width = width; 41 | self.frame = frame; 42 | } 43 | 44 | - (void)setHeight:(CGFloat)height 45 | { 46 | CGRect frame = self.frame; 47 | frame.size.height = height; 48 | self.frame = frame; 49 | } 50 | 51 | - (CGFloat)height 52 | { 53 | return self.frame.size.height; 54 | } 55 | 56 | - (CGFloat)width 57 | { 58 | return self.frame.size.width; 59 | } 60 | 61 | - (UIView * (^)(CGFloat x))setX 62 | { 63 | return ^(CGFloat x) { 64 | self.x = x; 65 | return self; 66 | }; 67 | } 68 | 69 | - (void)setCenterX:(CGFloat)centerX 70 | { 71 | CGPoint center = self.center; 72 | center.x = centerX; 73 | self.center = center; 74 | } 75 | 76 | - (CGFloat)centerX 77 | { 78 | return self.center.x; 79 | } 80 | 81 | - (void)setCenterY:(CGFloat)centerY 82 | { 83 | CGPoint center = self.center; 84 | center.y = centerY; 85 | self.center = center; 86 | } 87 | 88 | - (CGFloat)centerY 89 | { 90 | return self.center.y; 91 | } 92 | 93 | - (void)setSize:(CGSize)size 94 | { 95 | CGRect frame = self.frame; 96 | frame.size = size; 97 | self.frame = frame; 98 | } 99 | 100 | - (CGSize)size 101 | { 102 | return self.frame.size; 103 | } 104 | 105 | - (void)setOrigin:(CGPoint)origin 106 | { 107 | CGRect frame = self.frame; 108 | frame.origin = origin; 109 | self.frame = frame; 110 | } 111 | 112 | - (CGPoint)origin 113 | { 114 | return self.frame.origin; 115 | } 116 | 117 | - (CGFloat)left { 118 | return self.frame.origin.x; 119 | } 120 | 121 | - (void)setLeft:(CGFloat)x { 122 | CGRect frame = self.frame; 123 | frame.origin.x = x; 124 | self.frame = frame; 125 | } 126 | 127 | - (CGFloat)top { 128 | return self.frame.origin.y; 129 | } 130 | 131 | - (void)setTop:(CGFloat)y { 132 | CGRect frame = self.frame; 133 | frame.origin.y = y; 134 | self.frame = frame; 135 | } 136 | 137 | - (CGFloat)right { 138 | return self.frame.origin.x + self.frame.size.width; 139 | } 140 | 141 | - (void)setRight:(CGFloat)right { 142 | CGRect frame = self.frame; 143 | frame.origin.x = right - frame.size.width; 144 | self.frame = frame; 145 | } 146 | 147 | - (CGFloat)bottom { 148 | return self.frame.origin.y + self.frame.size.height; 149 | } 150 | 151 | - (void)setBottom:(CGFloat)bottom { 152 | CGRect frame = self.frame; 153 | frame.origin.y = bottom - frame.size.height; 154 | self.frame = frame; 155 | } 156 | 157 | 158 | - (UIView *(^)(UIColor *color)) setColor 159 | { 160 | return ^ (UIColor *color) { 161 | self.backgroundColor = color; 162 | return self; 163 | }; 164 | } 165 | 166 | - (UIView *(^)(CGRect frame)) setFrame 167 | { 168 | return ^ (CGRect frame) { 169 | self.frame = frame; 170 | return self; 171 | }; 172 | } 173 | 174 | - (UIView *(^)(CGSize size)) setSize 175 | { 176 | return ^ (CGSize size) { 177 | self.bounds = CGRectMake(0, 0, size.width, size.height); 178 | return self; 179 | }; 180 | } 181 | 182 | - (UIView *(^)(CGPoint point)) setCenter 183 | { 184 | return ^ (CGPoint point) { 185 | self.center = point; 186 | return self; 187 | }; 188 | } 189 | 190 | - (UIView *(^)(NSInteger tag)) setTag 191 | { 192 | return ^ (NSInteger tag) { 193 | self.tag = tag; 194 | return self; 195 | }; 196 | } 197 | @end 198 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // STNavigationBar 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STNavigationBar on 15/11/22. 6 | // Copyright © 2015年 ST. 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 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBarTests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBarTests/STNavigationBarTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // STNavigationBarTests.m 3 | // STNavigationBarTests 4 | // 5 | // Created by rkxt_ios on 15/11/22. 6 | // Copyright © 2015年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface STNavigationBarTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation STNavigationBarTests 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 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBarUITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /STNavigationBar/STNavigationBarUITests/STNavigationBarUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // STNavigationBarUITests.m 3 | // STNavigationBarUITests 4 | // 5 | // Created by rkxt_ios on 15/11/22. 6 | // Copyright © 2015年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface STNavigationBarUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation STNavigationBarUITests 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 | --------------------------------------------------------------------------------