├── .gitignore ├── LICENSE ├── LTNavigationBar.podspec ├── LTNavigationBar.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── LTNavigationBar.xccheckout ├── LTNavigationBar ├── AppDelegate.h ├── AppDelegate.m ├── BGColorDemoViewController.h ├── BGColorDemoViewController.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ScrollingNavbarDemoViewController.h ├── ScrollingNavbarDemoViewController.m ├── UINavigationBar+Awesome.h ├── UINavigationBar+Awesome.m ├── bg.jpg └── main.m ├── LTNavigationBarTests ├── Info.plist └── LTNavigationBarTests.m ├── README.md └── images ├── demo.gif └── demo2.gif /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *~.nib 4 | 5 | build/ 6 | xcuserdata/ 7 | *.pbxuser 8 | *.perspective 9 | *.perspectivev3 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2015 ltebean 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | (MIT License) -------------------------------------------------------------------------------- /LTNavigationBar.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = "LTNavigationBar" 4 | s.version = "2.1.9" 5 | s.summary = "UINavigationBar Category which allows you to change its appearance dynamically" 6 | s.homepage = "https://github.com/ltebean/LTNavigationbar" 7 | s.license = "MIT" 8 | s.author = { "ltebean" => "yucong1118@gmail.com" } 9 | s.source = { :git => "https://github.com/ltebean/LTNavigationbar.git", :tag => 'v2.1.9'} 10 | s.source_files = "LTNavigationbar/UINavigationBar+Awesome.{h,m}" 11 | s.requires_arc = true 12 | s.platform = :ios, '7.0' 13 | 14 | end 15 | -------------------------------------------------------------------------------- /LTNavigationBar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FA32D3EB1A90ABF500E2E4D7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FA32D3EA1A90ABF500E2E4D7 /* main.m */; }; 11 | FA32D3EE1A90ABF500E2E4D7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FA32D3ED1A90ABF500E2E4D7 /* AppDelegate.m */; }; 12 | FA32D3F11A90ABF500E2E4D7 /* BGColorDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FA32D3F01A90ABF500E2E4D7 /* BGColorDemoViewController.m */; }; 13 | FA32D3F41A90ABF500E2E4D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA32D3F21A90ABF500E2E4D7 /* Main.storyboard */; }; 14 | FA32D3F61A90ABF500E2E4D7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA32D3F51A90ABF500E2E4D7 /* Images.xcassets */; }; 15 | FA32D3F91A90ABF500E2E4D7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA32D3F71A90ABF500E2E4D7 /* LaunchScreen.xib */; }; 16 | FA32D4051A90ABF500E2E4D7 /* LTNavigationBarTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FA32D4041A90ABF500E2E4D7 /* LTNavigationBarTests.m */; }; 17 | FA32D4141A90ACD600E2E4D7 /* UINavigationBar+Awesome.m in Sources */ = {isa = PBXBuildFile; fileRef = FA32D4131A90ACD600E2E4D7 /* UINavigationBar+Awesome.m */; }; 18 | FA32D4191A90B29A00E2E4D7 /* bg.jpg in Resources */ = {isa = PBXBuildFile; fileRef = FA32D4181A90B29A00E2E4D7 /* bg.jpg */; }; 19 | FA6B24B21AAC401600DF4B96 /* ScrollingNavbarDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FA6B24B11AAC401600DF4B96 /* ScrollingNavbarDemoViewController.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | FA32D3FF1A90ABF500E2E4D7 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = FA32D3DD1A90ABF500E2E4D7 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = FA32D3E41A90ABF500E2E4D7; 28 | remoteInfo = LTNavigationBar; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | FA32D3E51A90ABF500E2E4D7 /* LTNavigationBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LTNavigationBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | FA32D3E91A90ABF500E2E4D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | FA32D3EA1A90ABF500E2E4D7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | FA32D3EC1A90ABF500E2E4D7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | FA32D3ED1A90ABF500E2E4D7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | FA32D3EF1A90ABF500E2E4D7 /* BGColorDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BGColorDemoViewController.h; sourceTree = ""; }; 39 | FA32D3F01A90ABF500E2E4D7 /* BGColorDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BGColorDemoViewController.m; sourceTree = ""; }; 40 | FA32D3F31A90ABF500E2E4D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | FA32D3F51A90ABF500E2E4D7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | FA32D3F81A90ABF500E2E4D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | FA32D3FE1A90ABF500E2E4D7 /* LTNavigationBarTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LTNavigationBarTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | FA32D4031A90ABF500E2E4D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | FA32D4041A90ABF500E2E4D7 /* LTNavigationBarTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LTNavigationBarTests.m; sourceTree = ""; }; 46 | FA32D4121A90ACD600E2E4D7 /* UINavigationBar+Awesome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+Awesome.h"; sourceTree = ""; }; 47 | FA32D4131A90ACD600E2E4D7 /* UINavigationBar+Awesome.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+Awesome.m"; sourceTree = ""; }; 48 | FA32D4181A90B29A00E2E4D7 /* bg.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = bg.jpg; sourceTree = ""; }; 49 | FA6B24B01AAC401600DF4B96 /* ScrollingNavbarDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingNavbarDemoViewController.h; sourceTree = ""; }; 50 | FA6B24B11AAC401600DF4B96 /* ScrollingNavbarDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollingNavbarDemoViewController.m; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | FA32D3E21A90ABF500E2E4D7 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | FA32D3FB1A90ABF500E2E4D7 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | FA32D3DC1A90ABF500E2E4D7 = { 72 | isa = PBXGroup; 73 | children = ( 74 | FA32D3E71A90ABF500E2E4D7 /* LTNavigationBar */, 75 | FA32D4011A90ABF500E2E4D7 /* LTNavigationBarTests */, 76 | FA32D3E61A90ABF500E2E4D7 /* Products */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | FA32D3E61A90ABF500E2E4D7 /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | FA32D3E51A90ABF500E2E4D7 /* LTNavigationBar.app */, 84 | FA32D3FE1A90ABF500E2E4D7 /* LTNavigationBarTests.xctest */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | FA32D3E71A90ABF500E2E4D7 /* LTNavigationBar */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | FA32D40E1A90ABFB00E2E4D7 /* lib */, 93 | FA32D3EC1A90ABF500E2E4D7 /* AppDelegate.h */, 94 | FA32D3ED1A90ABF500E2E4D7 /* AppDelegate.m */, 95 | FA32D3EF1A90ABF500E2E4D7 /* BGColorDemoViewController.h */, 96 | FA32D3F01A90ABF500E2E4D7 /* BGColorDemoViewController.m */, 97 | FA6B24B01AAC401600DF4B96 /* ScrollingNavbarDemoViewController.h */, 98 | FA6B24B11AAC401600DF4B96 /* ScrollingNavbarDemoViewController.m */, 99 | FA32D3F21A90ABF500E2E4D7 /* Main.storyboard */, 100 | FA32D3F51A90ABF500E2E4D7 /* Images.xcassets */, 101 | FA32D3F71A90ABF500E2E4D7 /* LaunchScreen.xib */, 102 | FA32D3E81A90ABF500E2E4D7 /* Supporting Files */, 103 | ); 104 | path = LTNavigationBar; 105 | sourceTree = ""; 106 | }; 107 | FA32D3E81A90ABF500E2E4D7 /* Supporting Files */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | FA32D4151A90AE4600E2E4D7 /* images */, 111 | FA32D3E91A90ABF500E2E4D7 /* Info.plist */, 112 | FA32D3EA1A90ABF500E2E4D7 /* main.m */, 113 | ); 114 | name = "Supporting Files"; 115 | sourceTree = ""; 116 | }; 117 | FA32D4011A90ABF500E2E4D7 /* LTNavigationBarTests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | FA32D4041A90ABF500E2E4D7 /* LTNavigationBarTests.m */, 121 | FA32D4021A90ABF500E2E4D7 /* Supporting Files */, 122 | ); 123 | path = LTNavigationBarTests; 124 | sourceTree = ""; 125 | }; 126 | FA32D4021A90ABF500E2E4D7 /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | FA32D4031A90ABF500E2E4D7 /* Info.plist */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | FA32D40E1A90ABFB00E2E4D7 /* lib */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | FA32D4121A90ACD600E2E4D7 /* UINavigationBar+Awesome.h */, 138 | FA32D4131A90ACD600E2E4D7 /* UINavigationBar+Awesome.m */, 139 | ); 140 | name = lib; 141 | sourceTree = ""; 142 | }; 143 | FA32D4151A90AE4600E2E4D7 /* images */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | FA32D4181A90B29A00E2E4D7 /* bg.jpg */, 147 | ); 148 | name = images; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | FA32D3E41A90ABF500E2E4D7 /* LTNavigationBar */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = FA32D4081A90ABF500E2E4D7 /* Build configuration list for PBXNativeTarget "LTNavigationBar" */; 157 | buildPhases = ( 158 | FA32D3E11A90ABF500E2E4D7 /* Sources */, 159 | FA32D3E21A90ABF500E2E4D7 /* Frameworks */, 160 | FA32D3E31A90ABF500E2E4D7 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = LTNavigationBar; 167 | productName = LTNavigationBar; 168 | productReference = FA32D3E51A90ABF500E2E4D7 /* LTNavigationBar.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | FA32D3FD1A90ABF500E2E4D7 /* LTNavigationBarTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = FA32D40B1A90ABF500E2E4D7 /* Build configuration list for PBXNativeTarget "LTNavigationBarTests" */; 174 | buildPhases = ( 175 | FA32D3FA1A90ABF500E2E4D7 /* Sources */, 176 | FA32D3FB1A90ABF500E2E4D7 /* Frameworks */, 177 | FA32D3FC1A90ABF500E2E4D7 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | FA32D4001A90ABF500E2E4D7 /* PBXTargetDependency */, 183 | ); 184 | name = LTNavigationBarTests; 185 | productName = LTNavigationBarTests; 186 | productReference = FA32D3FE1A90ABF500E2E4D7 /* LTNavigationBarTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | /* End PBXNativeTarget section */ 190 | 191 | /* Begin PBXProject section */ 192 | FA32D3DD1A90ABF500E2E4D7 /* Project object */ = { 193 | isa = PBXProject; 194 | attributes = { 195 | LastUpgradeCheck = 0610; 196 | ORGANIZATIONNAME = ltebean; 197 | TargetAttributes = { 198 | FA32D3E41A90ABF500E2E4D7 = { 199 | CreatedOnToolsVersion = 6.1.1; 200 | }; 201 | FA32D3FD1A90ABF500E2E4D7 = { 202 | CreatedOnToolsVersion = 6.1.1; 203 | TestTargetID = FA32D3E41A90ABF500E2E4D7; 204 | }; 205 | }; 206 | }; 207 | buildConfigurationList = FA32D3E01A90ABF500E2E4D7 /* Build configuration list for PBXProject "LTNavigationBar" */; 208 | compatibilityVersion = "Xcode 3.2"; 209 | developmentRegion = English; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | Base, 214 | ); 215 | mainGroup = FA32D3DC1A90ABF500E2E4D7; 216 | productRefGroup = FA32D3E61A90ABF500E2E4D7 /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | FA32D3E41A90ABF500E2E4D7 /* LTNavigationBar */, 221 | FA32D3FD1A90ABF500E2E4D7 /* LTNavigationBarTests */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXResourcesBuildPhase section */ 227 | FA32D3E31A90ABF500E2E4D7 /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | FA32D4191A90B29A00E2E4D7 /* bg.jpg in Resources */, 232 | FA32D3F41A90ABF500E2E4D7 /* Main.storyboard in Resources */, 233 | FA32D3F91A90ABF500E2E4D7 /* LaunchScreen.xib in Resources */, 234 | FA32D3F61A90ABF500E2E4D7 /* Images.xcassets in Resources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | FA32D3FC1A90ABF500E2E4D7 /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | FA32D3E11A90ABF500E2E4D7 /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | FA32D3F11A90ABF500E2E4D7 /* BGColorDemoViewController.m in Sources */, 253 | FA6B24B21AAC401600DF4B96 /* ScrollingNavbarDemoViewController.m in Sources */, 254 | FA32D3EE1A90ABF500E2E4D7 /* AppDelegate.m in Sources */, 255 | FA32D3EB1A90ABF500E2E4D7 /* main.m in Sources */, 256 | FA32D4141A90ACD600E2E4D7 /* UINavigationBar+Awesome.m in Sources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | FA32D3FA1A90ABF500E2E4D7 /* Sources */ = { 261 | isa = PBXSourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | FA32D4051A90ABF500E2E4D7 /* LTNavigationBarTests.m in Sources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | /* End PBXSourcesBuildPhase section */ 269 | 270 | /* Begin PBXTargetDependency section */ 271 | FA32D4001A90ABF500E2E4D7 /* PBXTargetDependency */ = { 272 | isa = PBXTargetDependency; 273 | target = FA32D3E41A90ABF500E2E4D7 /* LTNavigationBar */; 274 | targetProxy = FA32D3FF1A90ABF500E2E4D7 /* PBXContainerItemProxy */; 275 | }; 276 | /* End PBXTargetDependency section */ 277 | 278 | /* Begin PBXVariantGroup section */ 279 | FA32D3F21A90ABF500E2E4D7 /* Main.storyboard */ = { 280 | isa = PBXVariantGroup; 281 | children = ( 282 | FA32D3F31A90ABF500E2E4D7 /* Base */, 283 | ); 284 | name = Main.storyboard; 285 | sourceTree = ""; 286 | }; 287 | FA32D3F71A90ABF500E2E4D7 /* LaunchScreen.xib */ = { 288 | isa = PBXVariantGroup; 289 | children = ( 290 | FA32D3F81A90ABF500E2E4D7 /* Base */, 291 | ); 292 | name = LaunchScreen.xib; 293 | sourceTree = ""; 294 | }; 295 | /* End PBXVariantGroup section */ 296 | 297 | /* Begin XCBuildConfiguration section */ 298 | FA32D4061A90ABF500E2E4D7 /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 303 | CLANG_CXX_LIBRARY = "libc++"; 304 | CLANG_ENABLE_MODULES = YES; 305 | CLANG_ENABLE_OBJC_ARC = YES; 306 | CLANG_WARN_BOOL_CONVERSION = YES; 307 | CLANG_WARN_CONSTANT_CONVERSION = YES; 308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 309 | CLANG_WARN_EMPTY_BODY = YES; 310 | CLANG_WARN_ENUM_CONVERSION = YES; 311 | CLANG_WARN_INT_CONVERSION = YES; 312 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 313 | CLANG_WARN_UNREACHABLE_CODE = YES; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 316 | COPY_PHASE_STRIP = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_DYNAMIC_NO_PIC = NO; 320 | GCC_OPTIMIZATION_LEVEL = 0; 321 | GCC_PREPROCESSOR_DEFINITIONS = ( 322 | "DEBUG=1", 323 | "$(inherited)", 324 | ); 325 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 333 | MTL_ENABLE_DEBUG_INFO = YES; 334 | ONLY_ACTIVE_ARCH = YES; 335 | SDKROOT = iphoneos; 336 | }; 337 | name = Debug; 338 | }; 339 | FA32D4071A90ABF500E2E4D7 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_CONSTANT_CONVERSION = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INT_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = YES; 358 | ENABLE_NS_ASSERTIONS = NO; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | GCC_C_LANGUAGE_STANDARD = gnu99; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | SDKROOT = iphoneos; 370 | VALIDATE_PRODUCT = YES; 371 | }; 372 | name = Release; 373 | }; 374 | FA32D4091A90ABF500E2E4D7 /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | DEVELOPMENT_TEAM = ""; 379 | INFOPLIST_FILE = LTNavigationBar/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Debug; 384 | }; 385 | FA32D40A1A90ABF500E2E4D7 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | DEVELOPMENT_TEAM = ""; 390 | INFOPLIST_FILE = LTNavigationBar/Info.plist; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | }; 394 | name = Release; 395 | }; 396 | FA32D40C1A90ABF500E2E4D7 /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | BUNDLE_LOADER = "$(TEST_HOST)"; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(SDKROOT)/Developer/Library/Frameworks", 402 | "$(inherited)", 403 | ); 404 | GCC_PREPROCESSOR_DEFINITIONS = ( 405 | "DEBUG=1", 406 | "$(inherited)", 407 | ); 408 | INFOPLIST_FILE = LTNavigationBarTests/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LTNavigationBar.app/LTNavigationBar"; 412 | }; 413 | name = Debug; 414 | }; 415 | FA32D40D1A90ABF500E2E4D7 /* Release */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | BUNDLE_LOADER = "$(TEST_HOST)"; 419 | FRAMEWORK_SEARCH_PATHS = ( 420 | "$(SDKROOT)/Developer/Library/Frameworks", 421 | "$(inherited)", 422 | ); 423 | INFOPLIST_FILE = LTNavigationBarTests/Info.plist; 424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LTNavigationBar.app/LTNavigationBar"; 427 | }; 428 | name = Release; 429 | }; 430 | /* End XCBuildConfiguration section */ 431 | 432 | /* Begin XCConfigurationList section */ 433 | FA32D3E01A90ABF500E2E4D7 /* Build configuration list for PBXProject "LTNavigationBar" */ = { 434 | isa = XCConfigurationList; 435 | buildConfigurations = ( 436 | FA32D4061A90ABF500E2E4D7 /* Debug */, 437 | FA32D4071A90ABF500E2E4D7 /* Release */, 438 | ); 439 | defaultConfigurationIsVisible = 0; 440 | defaultConfigurationName = Release; 441 | }; 442 | FA32D4081A90ABF500E2E4D7 /* Build configuration list for PBXNativeTarget "LTNavigationBar" */ = { 443 | isa = XCConfigurationList; 444 | buildConfigurations = ( 445 | FA32D4091A90ABF500E2E4D7 /* Debug */, 446 | FA32D40A1A90ABF500E2E4D7 /* Release */, 447 | ); 448 | defaultConfigurationIsVisible = 0; 449 | defaultConfigurationName = Release; 450 | }; 451 | FA32D40B1A90ABF500E2E4D7 /* Build configuration list for PBXNativeTarget "LTNavigationBarTests" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | FA32D40C1A90ABF500E2E4D7 /* Debug */, 455 | FA32D40D1A90ABF500E2E4D7 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | /* End XCConfigurationList section */ 461 | }; 462 | rootObject = FA32D3DD1A90ABF500E2E4D7 /* Project object */; 463 | } 464 | -------------------------------------------------------------------------------- /LTNavigationBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LTNavigationBar.xcodeproj/project.xcworkspace/xcshareddata/LTNavigationBar.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | B06C2226-33BF-46B3-AE66-4C84CB4BAE7B 9 | IDESourceControlProjectName 10 | LTNavigationBar 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 19849F2F4EFB6A308341C5ABCABE9E044D80DA72 14 | https://github.com/ltebean/LTNavigationBar.git 15 | 16 | IDESourceControlProjectPath 17 | LTNavigationBar.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 19849F2F4EFB6A308341C5ABCABE9E044D80DA72 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/ltebean/LTNavigationBar.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 19849F2F4EFB6A308341C5ABCABE9E044D80DA72 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 19849F2F4EFB6A308341C5ABCABE9E044D80DA72 36 | IDESourceControlWCCName 37 | LTNavigationBar 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LTNavigationBar/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. 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 | -------------------------------------------------------------------------------- /LTNavigationBar/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | 21 | [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; 22 | [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0/255.0 green:175/255.0 blue:240/255.0 alpha:1]]; 23 | [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: 24 | [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont systemFontOfSize:21], NSFontAttributeName, nil]]; 25 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 26 | return YES; 27 | } 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // 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. 31 | // 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. 32 | } 33 | 34 | - (void)applicationDidEnterBackground:(UIApplication *)application { 35 | // 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. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | - (void)applicationWillEnterForeground:(UIApplication *)application { 40 | // 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. 41 | } 42 | 43 | - (void)applicationDidBecomeActive:(UIApplication *)application { 44 | // 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. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /LTNavigationBar/BGColorDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BGColorDemoViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LTNavigationBar/BGColorDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import "BGColorDemoViewController.h" 10 | #import "UINavigationBar+Awesome.h" 11 | 12 | #define NAVBAR_CHANGE_POINT 50 13 | 14 | @interface BGColorDemoViewController () 15 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 16 | @end 17 | 18 | @implementation BGColorDemoViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | self.tableView.dataSource = self; 24 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; 25 | [self.navigationController.navigationBar lt_setBackgroundColor:[UIColor clearColor]]; 26 | } 27 | 28 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 29 | { 30 | UIColor * color = [UIColor colorWithRed:0/255.0 green:175/255.0 blue:240/255.0 alpha:1]; 31 | CGFloat offsetY = scrollView.contentOffset.y; 32 | if (offsetY > NAVBAR_CHANGE_POINT) { 33 | CGFloat alpha = MIN(1, 1 - ((NAVBAR_CHANGE_POINT + 64 - offsetY) / 64)); 34 | [self.navigationController.navigationBar lt_setBackgroundColor:[color colorWithAlphaComponent:alpha]]; 35 | } else { 36 | [self.navigationController.navigationBar lt_setBackgroundColor:[color colorWithAlphaComponent:0]]; 37 | } 38 | } 39 | 40 | - (void)viewWillAppear:(BOOL)animated 41 | { 42 | [super viewWillAppear:YES]; 43 | self.tableView.delegate = self; 44 | [self scrollViewDidScroll:self.tableView]; 45 | [self.navigationController.navigationBar setShadowImage:[UIImage new]]; 46 | } 47 | 48 | - (void)viewWillDisappear:(BOOL)animated 49 | { 50 | [super viewWillDisappear:animated]; 51 | self.tableView.delegate = nil; 52 | [self.navigationController.navigationBar lt_reset]; 53 | } 54 | 55 | #pragma mark UITableViewDatasource 56 | 57 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 58 | { 59 | return @"header"; 60 | } 61 | 62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 63 | { 64 | return 5; 65 | } 66 | 67 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 68 | { 69 | return 5; 70 | } 71 | 72 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | static NSString *CellIdentifier = @"Cell"; 75 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 76 | cell.textLabel.text = @"text"; 77 | return cell; 78 | } 79 | 80 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 81 | { 82 | return 65; 83 | } 84 | 85 | 86 | - (void)didReceiveMemoryWarning { 87 | [super didReceiveMemoryWarning]; 88 | // Dispose of any resources that can be recreated. 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /LTNavigationBar/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LTNavigationBar/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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 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 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /LTNavigationBar/Images.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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LTNavigationBar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | io.ltebean.$(PRODUCT_NAME:rfc1034identifier) 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 | UIViewControllerBasedStatusBarAppearance 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LTNavigationBar/ScrollingNavbarDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ContentAlphaDemoViewController.h 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15/3/8. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ScrollingNavbarDemoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LTNavigationBar/ScrollingNavbarDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ContentAlphaDemoViewController.m 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15/3/8. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import "ScrollingNavbarDemoViewController.h" 10 | #import "UINavigationBar+Awesome.h" 11 | 12 | @interface ScrollingNavbarDemoViewController() 13 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 14 | @end 15 | 16 | @implementation ScrollingNavbarDemoViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | self.tableView.delegate = self; 22 | self.tableView.dataSource = self; 23 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; 24 | } 25 | 26 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 27 | { 28 | CGFloat offsetY = scrollView.contentOffset.y; 29 | if (offsetY > 0) { 30 | if (offsetY >= 44) { 31 | [self setNavigationBarTransformProgress:1]; 32 | } else { 33 | [self setNavigationBarTransformProgress:(offsetY / 44)]; 34 | } 35 | } else { 36 | [self setNavigationBarTransformProgress:0]; 37 | self.navigationController.navigationBar.backIndicatorImage = [UIImage new]; 38 | } 39 | } 40 | 41 | - (void)setNavigationBarTransformProgress:(CGFloat)progress 42 | { 43 | [self.navigationController.navigationBar lt_setTranslationY:(-44 * progress)]; 44 | [self.navigationController.navigationBar lt_setElementsAlpha:(1-progress)]; 45 | } 46 | 47 | - (void)viewWillAppear:(BOOL)animated 48 | { 49 | [super viewWillAppear:YES]; 50 | } 51 | 52 | - (void)viewWillDisappear:(BOOL)animated 53 | { 54 | [super viewWillDisappear:animated]; 55 | [self.navigationController.navigationBar lt_reset]; 56 | } 57 | 58 | #pragma mark UITableViewDatasource 59 | 60 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 61 | { 62 | return 10; 63 | } 64 | 65 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 66 | { 67 | return 1; 68 | } 69 | 70 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 71 | { 72 | static NSString *CellIdentifier = @"Cell"; 73 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 74 | cell.textLabel.text = @"text"; 75 | return cell; 76 | } 77 | 78 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 79 | { 80 | return 65; 81 | } 82 | 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /LTNavigationBar/UINavigationBar+Awesome.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+Awesome.h 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015 ltebean. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationBar (Awesome) 12 | - (void)lt_setBackgroundColor:(UIColor *)backgroundColor; 13 | - (void)lt_setElementsAlpha:(CGFloat)alpha; 14 | - (void)lt_setTranslationY:(CGFloat)translationY; 15 | - (void)lt_reset; 16 | @end 17 | -------------------------------------------------------------------------------- /LTNavigationBar/UINavigationBar+Awesome.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+Awesome.m 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015 ltebean. All rights reserved. 7 | // 8 | 9 | #import "UINavigationBar+Awesome.h" 10 | #import 11 | 12 | #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) 13 | 14 | @implementation UINavigationBar (Awesome) 15 | static char overlayKey; 16 | 17 | - (UIView *)overlay 18 | { 19 | return objc_getAssociatedObject(self, &overlayKey); 20 | } 21 | 22 | - (void)setOverlay:(UIView *)overlay 23 | { 24 | objc_setAssociatedObject(self, &overlayKey, overlay, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 25 | } 26 | 27 | - (void)lt_setBackgroundColor:(UIColor *)backgroundColor 28 | { 29 | if (!self.overlay) { 30 | [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; 31 | self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)]; 32 | self.overlay.userInteractionEnabled = NO; 33 | self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth; // Should not set `UIViewAutoresizingFlexibleHeight` 34 | [[self.subviews firstObject] insertSubview:self.overlay atIndex:0]; 35 | } 36 | self.overlay.backgroundColor = backgroundColor; 37 | } 38 | 39 | - (void)lt_setTranslationY:(CGFloat)translationY 40 | { 41 | self.transform = CGAffineTransformMakeTranslation(0, translationY); 42 | } 43 | 44 | - (void)lt_setElementsAlpha:(CGFloat)alpha 45 | { 46 | [[self valueForKey:@"_leftViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) { 47 | view.alpha = alpha; 48 | }]; 49 | 50 | [[self valueForKey:@"_rightViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) { 51 | view.alpha = alpha; 52 | }]; 53 | 54 | UIView *titleView = [self valueForKey:@"_titleView"]; 55 | titleView.alpha = alpha; 56 | // when viewController first load, the titleView maybe nil 57 | [[self subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) { 58 | if ([obj isKindOfClass:NSClassFromString(@"UINavigationItemView")]) { 59 | obj.alpha = alpha; 60 | } 61 | if ([obj isKindOfClass:NSClassFromString(@"_UINavigationBarBackIndicatorView")]) { 62 | obj.alpha = alpha; 63 | } 64 | }]; 65 | } 66 | 67 | - (void)lt_reset 68 | { 69 | [self setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 70 | [self.overlay removeFromSuperview]; 71 | self.overlay = nil; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /LTNavigationBar/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltebean/LTNavigationBar/2dbb42e416d8bccc87cee7e6a1a76343f993423f/LTNavigationBar/bg.jpg -------------------------------------------------------------------------------- /LTNavigationBar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LTNavigationBar 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. 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 | -------------------------------------------------------------------------------- /LTNavigationBarTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | io.ltebean.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /LTNavigationBarTests/LTNavigationBarTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LTNavigationBarTests.m 3 | // LTNavigationBarTests 4 | // 5 | // Created by ltebean on 15-2-15. 6 | // Copyright (c) 2015年 ltebean. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LTNavigationBarTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation LTNavigationBarTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![LTNavigationbar](https://cocoapod-badges.herokuapp.com/v/LTNavigationBar/badge.png) 2 | 3 | 4 | ## Deprecated 5 | This lib uses a hacky way to achieve the result, in the new iOS version, the structure of UINavigation is changed and this lib no longer works anymore, so please check these alternatives: 6 | 7 | - https://github.com/andreamazz/AMScrollingNavbar 8 | - https://github.com/DanisFabric/RainbowNavigation 9 | - https://github.com/MoZhouqi/KMNavigationBarTransition 10 | 11 | 12 | ## swift version 13 | 14 | [https://github.com/ltebean/LTNavigationBar/tree/swift3.0](https://github.com/ltebean/LTNavigationBar/tree/swift3.0) 15 | 16 | ## Purpose 17 | It is hard to change the appearance of UINavigationBar dynamically, so I made this lib to make the job easy. 18 | 19 | 20 | ## Demo 21 | #### 1. Changing the background color: 22 | ![LTNavigationbar](https://raw.githubusercontent.com/ltebean/LTNavigationBar/master/images/demo.gif) 23 | 24 | 25 | #### 2. Making navigation bar scroll along with a scroll view: 26 | ![LTNavigationbar](https://raw.githubusercontent.com/ltebean/LTNavigationBar/master/images/demo2.gif) 27 | 28 | ## Usage 29 | 30 | First, import this lib: 31 | ```objective-c 32 | #import "UINavigationBar+Awesome.h" 33 | ``` 34 | 35 | The category includes lots of method that helps to change UINavigationBar's appearance dynamically: 36 | ```objective-c 37 | @interface UINavigationBar (Awesome) 38 | - (void)lt_setBackgroundColor:(UIColor *)backgroundColor; 39 | - (void)lt_setElementsAlpha:(CGFloat)alpha; 40 | - (void)lt_setTranslationY:(CGFloat)translationY; 41 | - (void)lt_reset; 42 | @end 43 | ``` 44 | 45 | You can call the various setter wherever you want, like: 46 | ```objective-c 47 | [self.navigationController.navigationBar lt_setBackgroundColor:[UIColor blueColor]]; 48 | ``` 49 | 50 | And usually in `viewWillDisappear`, you should call this method to avoid any side effects: 51 | ```objective-c 52 | - (void)viewWillDisappear:(BOOL)animated 53 | { 54 | [super viewWillDisappear:animated]; 55 | [self.navigationController.navigationBar lt_reset]; 56 | } 57 | ``` 58 | 59 | See the example for details~ 60 | -------------------------------------------------------------------------------- /images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltebean/LTNavigationBar/2dbb42e416d8bccc87cee7e6a1a76343f993423f/images/demo.gif -------------------------------------------------------------------------------- /images/demo2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltebean/LTNavigationBar/2dbb42e416d8bccc87cee7e6a1a76343f993423f/images/demo2.gif --------------------------------------------------------------------------------