├── .gitignore ├── JXGradientNavigationBar.podspec ├── JXGradientNavigationBar ├── JXGradientNavigationBar.h └── JXGradientNavigationBar.m ├── JXGradientNavigationBarExample ├── JXGradientNavigationBarExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── JXGradientNavigationBarExample.xcworkspace │ └── contents.xcworkspacedata ├── JXGradientNavigationBarExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── JXGradientNavigationBarExampleTests │ ├── Info.plist │ └── JXGradientNavigationBarExampleTests.m ├── Podfile ├── Podfile.lock └── ScreenShot.png ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | -------------------------------------------------------------------------------- /JXGradientNavigationBar.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint JXGradientNavigationBar.podspec' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # Any lines starting with a # are optional, but encouraged 6 | # 7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 8 | # 9 | 10 | Pod::Spec.new do |s| 11 | s.name = "JXGradientNavigationBar" 12 | s.version = "0.1.2" 13 | s.summary = "Custom UINavigationBar subclass with gradient colors on iOS." 14 | s.homepage = "https://bailushuyuan.org" 15 | s.screenshots = "https://github.com/swordray/JXGradientNavigationBar/raw/#{s.version.to_s}/JXGradientNavigationBarExample/ScreenShot.png" 16 | s.license = 'MIT' 17 | s.author = { "Jianqiu Xiao" => "swordray@gmail.com" } 18 | s.source = { :git => "https://github.com/swordray/JXGradientNavigationBar.git", :tag => s.version.to_s } 19 | 20 | s.platform = :ios, '7.0' 21 | s.requires_arc = true 22 | 23 | s.source_files = 'JXGradientNavigationBar/**/*' 24 | 25 | s.frameworks = 'UIKit' 26 | end 27 | -------------------------------------------------------------------------------- /JXGradientNavigationBar/JXGradientNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // JXGradientNavigationBar.h 3 | // JXGradientNavigationBar 4 | // 5 | // Created by Jianqiu Xiao on 09/07/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JXGradientNavigationBar : UINavigationBar 12 | 13 | @property (nonatomic) NSArray * barTintGradientColors; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /JXGradientNavigationBar/JXGradientNavigationBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXGradientNavigationBar.m 3 | // JXGradientNavigationBar 4 | // 5 | // Created by Jianqiu Xiao on 09/07/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import "JXGradientNavigationBar.h" 10 | 11 | @implementation JXGradientNavigationBar 12 | 13 | @synthesize barTintGradientColors = _barTintGradientColors; 14 | 15 | - (void)setBarTintGradientColors:(NSArray *)barTintGradientColors 16 | { 17 | _barTintGradientColors = barTintGradientColors; 18 | [self setBackgroundImage:[self gradientBackgroundImage:barTintGradientColors height:64] forBarMetrics:UIBarMetricsDefault]; 19 | [self setBackgroundImage:[self gradientBackgroundImage:barTintGradientColors height:32] forBarMetrics:UIBarMetricsCompact]; 20 | } 21 | 22 | - (UIImage *)gradientBackgroundImage:(NSArray *)colors height:(CGFloat)height 23 | { 24 | CGFloat components[colors.count * 4]; 25 | for (int i = 0; i < colors.count; i++) { 26 | CGFloat red, green, blue, alpha; 27 | [colors[i] getRed:&red green:&green blue:&blue alpha:&alpha]; 28 | components[i * 4] = red; 29 | components[i * 4 + 1] = green; 30 | components[i * 4 + 2] = blue; 31 | components[i * 4 + 3] = alpha; 32 | } 33 | CGSize size = CGSizeMake(1, height * [UIScreen mainScreen].scale); 34 | UIGraphicsBeginImageContextWithOptions(size, YES, 0); 35 | CGContextRef context = UIGraphicsGetCurrentContext(); 36 | CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); 37 | CGGradientRef gradient = CGGradientCreateWithColorComponents(space, components, NULL, colors.count); 38 | CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 0), CGPointMake(0, size.height), 0); 39 | UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); 40 | UIGraphicsEndImageContext(); 41 | return image; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0A6E94A155CF0FA238F97DD0 /* libPods-JXGradientNavigationBarExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D4FE2342FAF981C22328ECF /* libPods-JXGradientNavigationBarExample.a */; }; 11 | B2FF9CD51B4F675D00EF5716 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B2FF9CD41B4F675D00EF5716 /* main.m */; }; 12 | B2FF9CD81B4F675D00EF5716 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B2FF9CD71B4F675D00EF5716 /* AppDelegate.m */; }; 13 | B2FF9CDB1B4F675D00EF5716 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2FF9CDA1B4F675D00EF5716 /* ViewController.m */; }; 14 | B2FF9CE01B4F675D00EF5716 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2FF9CDF1B4F675D00EF5716 /* Images.xcassets */; }; 15 | B2FF9CEF1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2FF9CEE1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.m */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | B2FF9CE91B4F675E00EF5716 /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = B2FF9CC71B4F675D00EF5716 /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = B2FF9CCE1B4F675D00EF5716; 24 | remoteInfo = JXGradientNavigationBarExample; 25 | }; 26 | /* End PBXContainerItemProxy section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 187F268A0805C5CAADB07C03 /* Pods-JXGradientNavigationBarExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXGradientNavigationBarExample.release.xcconfig"; path = "Target Support Files/Pods-JXGradientNavigationBarExample/Pods-JXGradientNavigationBarExample.release.xcconfig"; sourceTree = ""; }; 30 | 3C7FA48BE3815B7104D4EB4A /* Pods-JXGradientNavigationBarExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXGradientNavigationBarExample.debug.xcconfig"; path = "Target Support Files/Pods-JXGradientNavigationBarExample/Pods-JXGradientNavigationBarExample.debug.xcconfig"; sourceTree = ""; }; 31 | 4D4FE2342FAF981C22328ECF /* libPods-JXGradientNavigationBarExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JXGradientNavigationBarExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | B2FF9CCF1B4F675D00EF5716 /* JXGradientNavigationBarExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JXGradientNavigationBarExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | B2FF9CD31B4F675D00EF5716 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | B2FF9CD41B4F675D00EF5716 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | B2FF9CD61B4F675D00EF5716 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | B2FF9CD71B4F675D00EF5716 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | B2FF9CD91B4F675D00EF5716 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 38 | B2FF9CDA1B4F675D00EF5716 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 39 | B2FF9CDF1B4F675D00EF5716 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | B2FF9CE81B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JXGradientNavigationBarExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | B2FF9CED1B4F675E00EF5716 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | B2FF9CEE1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JXGradientNavigationBarExampleTests.m; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | B2FF9CCC1B4F675D00EF5716 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 0A6E94A155CF0FA238F97DD0 /* libPods-JXGradientNavigationBarExample.a in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | B2FF9CE51B4F675E00EF5716 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 406ACE26F5DBDBEF6CCCAB75 /* Frameworks */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 4D4FE2342FAF981C22328ECF /* libPods-JXGradientNavigationBarExample.a */, 68 | ); 69 | name = Frameworks; 70 | sourceTree = ""; 71 | }; 72 | B2FF9CC61B4F675D00EF5716 = { 73 | isa = PBXGroup; 74 | children = ( 75 | B2FF9CD11B4F675D00EF5716 /* JXGradientNavigationBarExample */, 76 | B2FF9CEB1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests */, 77 | B2FF9CD01B4F675D00EF5716 /* Products */, 78 | E3BE8732A47D3065176638DA /* Pods */, 79 | 406ACE26F5DBDBEF6CCCAB75 /* Frameworks */, 80 | ); 81 | sourceTree = ""; 82 | }; 83 | B2FF9CD01B4F675D00EF5716 /* Products */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | B2FF9CCF1B4F675D00EF5716 /* JXGradientNavigationBarExample.app */, 87 | B2FF9CE81B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.xctest */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | B2FF9CD11B4F675D00EF5716 /* JXGradientNavigationBarExample */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | B2FF9CD61B4F675D00EF5716 /* AppDelegate.h */, 96 | B2FF9CD71B4F675D00EF5716 /* AppDelegate.m */, 97 | B2FF9CD91B4F675D00EF5716 /* ViewController.h */, 98 | B2FF9CDA1B4F675D00EF5716 /* ViewController.m */, 99 | B2FF9CDF1B4F675D00EF5716 /* Images.xcassets */, 100 | B2FF9CD21B4F675D00EF5716 /* Supporting Files */, 101 | ); 102 | path = JXGradientNavigationBarExample; 103 | sourceTree = ""; 104 | }; 105 | B2FF9CD21B4F675D00EF5716 /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | B2FF9CD31B4F675D00EF5716 /* Info.plist */, 109 | B2FF9CD41B4F675D00EF5716 /* main.m */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | B2FF9CEB1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | B2FF9CEE1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.m */, 118 | B2FF9CEC1B4F675E00EF5716 /* Supporting Files */, 119 | ); 120 | path = JXGradientNavigationBarExampleTests; 121 | sourceTree = ""; 122 | }; 123 | B2FF9CEC1B4F675E00EF5716 /* Supporting Files */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | B2FF9CED1B4F675E00EF5716 /* Info.plist */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | E3BE8732A47D3065176638DA /* Pods */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 3C7FA48BE3815B7104D4EB4A /* Pods-JXGradientNavigationBarExample.debug.xcconfig */, 135 | 187F268A0805C5CAADB07C03 /* Pods-JXGradientNavigationBarExample.release.xcconfig */, 136 | ); 137 | name = Pods; 138 | path = Pods; 139 | sourceTree = ""; 140 | }; 141 | /* End PBXGroup section */ 142 | 143 | /* Begin PBXNativeTarget section */ 144 | B2FF9CCE1B4F675D00EF5716 /* JXGradientNavigationBarExample */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = B2FF9CF21B4F675E00EF5716 /* Build configuration list for PBXNativeTarget "JXGradientNavigationBarExample" */; 147 | buildPhases = ( 148 | 86937A987C5DB9688046AF41 /* [CP] Check Pods Manifest.lock */, 149 | B2FF9CCB1B4F675D00EF5716 /* Sources */, 150 | B2FF9CCC1B4F675D00EF5716 /* Frameworks */, 151 | B2FF9CCD1B4F675D00EF5716 /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = JXGradientNavigationBarExample; 158 | productName = JXGradientNavigationBarExample; 159 | productReference = B2FF9CCF1B4F675D00EF5716 /* JXGradientNavigationBarExample.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | B2FF9CE71B4F675E00EF5716 /* JXGradientNavigationBarExampleTests */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = B2FF9CF51B4F675E00EF5716 /* Build configuration list for PBXNativeTarget "JXGradientNavigationBarExampleTests" */; 165 | buildPhases = ( 166 | B2FF9CE41B4F675E00EF5716 /* Sources */, 167 | B2FF9CE51B4F675E00EF5716 /* Frameworks */, 168 | B2FF9CE61B4F675E00EF5716 /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | B2FF9CEA1B4F675E00EF5716 /* PBXTargetDependency */, 174 | ); 175 | name = JXGradientNavigationBarExampleTests; 176 | productName = JXGradientNavigationBarExampleTests; 177 | productReference = B2FF9CE81B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.xctest */; 178 | productType = "com.apple.product-type.bundle.unit-test"; 179 | }; 180 | /* End PBXNativeTarget section */ 181 | 182 | /* Begin PBXProject section */ 183 | B2FF9CC71B4F675D00EF5716 /* Project object */ = { 184 | isa = PBXProject; 185 | attributes = { 186 | LastUpgradeCheck = 0640; 187 | ORGANIZATIONNAME = "Jianqiu Xiao"; 188 | TargetAttributes = { 189 | B2FF9CCE1B4F675D00EF5716 = { 190 | CreatedOnToolsVersion = 6.4; 191 | }; 192 | B2FF9CE71B4F675E00EF5716 = { 193 | CreatedOnToolsVersion = 6.4; 194 | TestTargetID = B2FF9CCE1B4F675D00EF5716; 195 | }; 196 | }; 197 | }; 198 | buildConfigurationList = B2FF9CCA1B4F675D00EF5716 /* Build configuration list for PBXProject "JXGradientNavigationBarExample" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | en, 204 | Base, 205 | ); 206 | mainGroup = B2FF9CC61B4F675D00EF5716; 207 | productRefGroup = B2FF9CD01B4F675D00EF5716 /* Products */; 208 | projectDirPath = ""; 209 | projectRoot = ""; 210 | targets = ( 211 | B2FF9CCE1B4F675D00EF5716 /* JXGradientNavigationBarExample */, 212 | B2FF9CE71B4F675E00EF5716 /* JXGradientNavigationBarExampleTests */, 213 | ); 214 | }; 215 | /* End PBXProject section */ 216 | 217 | /* Begin PBXResourcesBuildPhase section */ 218 | B2FF9CCD1B4F675D00EF5716 /* Resources */ = { 219 | isa = PBXResourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | B2FF9CE01B4F675D00EF5716 /* Images.xcassets in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | B2FF9CE61B4F675E00EF5716 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXShellScriptBuildPhase section */ 236 | 86937A987C5DB9688046AF41 /* [CP] Check Pods Manifest.lock */ = { 237 | isa = PBXShellScriptBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | inputFileListPaths = ( 242 | ); 243 | inputPaths = ( 244 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 245 | "${PODS_ROOT}/Manifest.lock", 246 | ); 247 | name = "[CP] Check Pods Manifest.lock"; 248 | outputFileListPaths = ( 249 | ); 250 | outputPaths = ( 251 | "$(DERIVED_FILE_DIR)/Pods-JXGradientNavigationBarExample-checkManifestLockResult.txt", 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | shellPath = /bin/sh; 255 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 256 | showEnvVarsInLog = 0; 257 | }; 258 | /* End PBXShellScriptBuildPhase section */ 259 | 260 | /* Begin PBXSourcesBuildPhase section */ 261 | B2FF9CCB1B4F675D00EF5716 /* Sources */ = { 262 | isa = PBXSourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | B2FF9CDB1B4F675D00EF5716 /* ViewController.m in Sources */, 266 | B2FF9CD81B4F675D00EF5716 /* AppDelegate.m in Sources */, 267 | B2FF9CD51B4F675D00EF5716 /* main.m in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | B2FF9CE41B4F675E00EF5716 /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | B2FF9CEF1B4F675E00EF5716 /* JXGradientNavigationBarExampleTests.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | B2FF9CEA1B4F675E00EF5716 /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = B2FF9CCE1B4F675D00EF5716 /* JXGradientNavigationBarExample */; 285 | targetProxy = B2FF9CE91B4F675E00EF5716 /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin XCBuildConfiguration section */ 290 | B2FF9CF01B4F675E00EF5716 /* Debug */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | ALWAYS_SEARCH_USER_PATHS = NO; 294 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 295 | CLANG_CXX_LIBRARY = "libc++"; 296 | CLANG_ENABLE_MODULES = YES; 297 | CLANG_ENABLE_OBJC_ARC = YES; 298 | CLANG_WARN_BOOL_CONVERSION = YES; 299 | CLANG_WARN_CONSTANT_CONVERSION = YES; 300 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 301 | CLANG_WARN_EMPTY_BODY = YES; 302 | CLANG_WARN_ENUM_CONVERSION = YES; 303 | CLANG_WARN_INT_CONVERSION = YES; 304 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 305 | CLANG_WARN_UNREACHABLE_CODE = YES; 306 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 307 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 308 | COPY_PHASE_STRIP = NO; 309 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 310 | ENABLE_STRICT_OBJC_MSGSEND = YES; 311 | GCC_C_LANGUAGE_STANDARD = gnu99; 312 | GCC_DYNAMIC_NO_PIC = NO; 313 | GCC_NO_COMMON_BLOCKS = YES; 314 | GCC_OPTIMIZATION_LEVEL = 0; 315 | GCC_PREPROCESSOR_DEFINITIONS = ( 316 | "DEBUG=1", 317 | "$(inherited)", 318 | ); 319 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 320 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 321 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 322 | GCC_WARN_UNDECLARED_SELECTOR = YES; 323 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 324 | GCC_WARN_UNUSED_FUNCTION = YES; 325 | GCC_WARN_UNUSED_VARIABLE = YES; 326 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 327 | MTL_ENABLE_DEBUG_INFO = YES; 328 | ONLY_ACTIVE_ARCH = YES; 329 | SDKROOT = iphoneos; 330 | TARGETED_DEVICE_FAMILY = "1,2"; 331 | }; 332 | name = Debug; 333 | }; 334 | B2FF9CF11B4F675E00EF5716 /* Release */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ALWAYS_SEARCH_USER_PATHS = NO; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_CONSTANT_CONVERSION = YES; 344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INT_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_UNREACHABLE_CODE = YES; 350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 352 | COPY_PHASE_STRIP = NO; 353 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 354 | ENABLE_NS_ASSERTIONS = NO; 355 | ENABLE_STRICT_OBJC_MSGSEND = YES; 356 | GCC_C_LANGUAGE_STANDARD = gnu99; 357 | GCC_NO_COMMON_BLOCKS = YES; 358 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 359 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 360 | GCC_WARN_UNDECLARED_SELECTOR = YES; 361 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 362 | GCC_WARN_UNUSED_FUNCTION = YES; 363 | GCC_WARN_UNUSED_VARIABLE = YES; 364 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 365 | MTL_ENABLE_DEBUG_INFO = NO; 366 | SDKROOT = iphoneos; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | VALIDATE_PRODUCT = YES; 369 | }; 370 | name = Release; 371 | }; 372 | B2FF9CF31B4F675E00EF5716 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | baseConfigurationReference = 3C7FA48BE3815B7104D4EB4A /* Pods-JXGradientNavigationBarExample.debug.xcconfig */; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 378 | INFOPLIST_FILE = JXGradientNavigationBarExample/Info.plist; 379 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Debug; 384 | }; 385 | B2FF9CF41B4F675E00EF5716 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | baseConfigurationReference = 187F268A0805C5CAADB07C03 /* Pods-JXGradientNavigationBarExample.release.xcconfig */; 388 | buildSettings = { 389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 390 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 391 | INFOPLIST_FILE = JXGradientNavigationBarExample/Info.plist; 392 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | }; 396 | name = Release; 397 | }; 398 | B2FF9CF61B4F675E00EF5716 /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | BUNDLE_LOADER = "$(TEST_HOST)"; 402 | FRAMEWORK_SEARCH_PATHS = ( 403 | "$(SDKROOT)/Developer/Library/Frameworks", 404 | "$(inherited)", 405 | ); 406 | GCC_PREPROCESSOR_DEFINITIONS = ( 407 | "DEBUG=1", 408 | "$(inherited)", 409 | ); 410 | INFOPLIST_FILE = JXGradientNavigationBarExampleTests/Info.plist; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JXGradientNavigationBarExample.app/JXGradientNavigationBarExample"; 414 | }; 415 | name = Debug; 416 | }; 417 | B2FF9CF71B4F675E00EF5716 /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | BUNDLE_LOADER = "$(TEST_HOST)"; 421 | FRAMEWORK_SEARCH_PATHS = ( 422 | "$(SDKROOT)/Developer/Library/Frameworks", 423 | "$(inherited)", 424 | ); 425 | INFOPLIST_FILE = JXGradientNavigationBarExampleTests/Info.plist; 426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JXGradientNavigationBarExample.app/JXGradientNavigationBarExample"; 429 | }; 430 | name = Release; 431 | }; 432 | /* End XCBuildConfiguration section */ 433 | 434 | /* Begin XCConfigurationList section */ 435 | B2FF9CCA1B4F675D00EF5716 /* Build configuration list for PBXProject "JXGradientNavigationBarExample" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | B2FF9CF01B4F675E00EF5716 /* Debug */, 439 | B2FF9CF11B4F675E00EF5716 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | B2FF9CF21B4F675E00EF5716 /* Build configuration list for PBXNativeTarget "JXGradientNavigationBarExample" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | B2FF9CF31B4F675E00EF5716 /* Debug */, 448 | B2FF9CF41B4F675E00EF5716 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | defaultConfigurationName = Release; 452 | }; 453 | B2FF9CF51B4F675E00EF5716 /* Build configuration list for PBXNativeTarget "JXGradientNavigationBarExampleTests" */ = { 454 | isa = XCConfigurationList; 455 | buildConfigurations = ( 456 | B2FF9CF61B4F675E00EF5716 /* Debug */, 457 | B2FF9CF71B4F675E00EF5716 /* Release */, 458 | ); 459 | defaultConfigurationIsVisible = 0; 460 | defaultConfigurationName = Release; 461 | }; 462 | /* End XCConfigurationList section */ 463 | }; 464 | rootObject = B2FF9CC71B4F675D00EF5716 /* Project object */; 465 | } 466 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JXGradientNavigationBarExample 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. 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 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JXGradientNavigationBarExample 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "JXGradientNavigationBar.h" 11 | #import "ViewController.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 22 | 23 | [JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]]; 24 | [JXGradientNavigationBar appearance].shadowImage = [[UIImage alloc] init]; 25 | [JXGradientNavigationBar appearance].tintColor = [UIColor whiteColor]; 26 | [JXGradientNavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 27 | 28 | UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil]; 29 | navigationController.navigationBar.translucent = YES; 30 | navigationController.viewControllers = @[[[ViewController alloc] init]]; 31 | 32 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 33 | [self.window setRootViewController:navigationController]; 34 | [self.window makeKeyAndVisible]; 35 | 36 | return YES; 37 | } 38 | 39 | - (void)applicationWillResignActive:(UIApplication *)application { 40 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 41 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 42 | } 43 | 44 | - (void)applicationDidEnterBackground:(UIApplication *)application { 45 | // 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. 46 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 47 | } 48 | 49 | - (void)applicationWillEnterForeground:(UIApplication *)application { 50 | // 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. 51 | } 52 | 53 | - (void)applicationDidBecomeActive:(UIApplication *)application { 54 | // 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. 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application { 58 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/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 | "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 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.example.$(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 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JXGradientNavigationBarExample 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JXGradientNavigationBarExample 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | self.title = @"JXGradientNavigationBar"; 21 | 22 | UIWebView * webView = [[UIWebView alloc] init]; 23 | webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 24 | webView.frame = self.view.bounds; 25 | [self.view addSubview:webView]; 26 | 27 | [webView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"https://github.com/swordray/JXGradientNavigationBar"]]]; 28 | } 29 | 30 | - (void)didReceiveMemoryWarning { 31 | [super didReceiveMemoryWarning]; 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JXGradientNavigationBarExample 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. 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 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.example.$(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 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/JXGradientNavigationBarExampleTests/JXGradientNavigationBarExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXGradientNavigationBarExampleTests.m 3 | // JXGradientNavigationBarExampleTests 4 | // 5 | // Created by Jianqiu Xiao on 7/10/15. 6 | // Copyright (c) 2015 Jianqiu Xiao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JXGradientNavigationBarExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation JXGradientNavigationBarExampleTests 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 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | target 'JXGradientNavigationBarExample' do 4 | pod 'JXGradientNavigationBar', :path => '../' 5 | end 6 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - JXGradientNavigationBar (0.1.2) 3 | 4 | DEPENDENCIES: 5 | - JXGradientNavigationBar (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | JXGradientNavigationBar: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | JXGradientNavigationBar: b752fbc1912d7abbbb1e427bb2d24fc0284511b0 13 | 14 | PODFILE CHECKSUM: 18459bb526b6a56b965939727dcc9a716c20a11a 15 | 16 | COCOAPODS: 1.11.2 17 | -------------------------------------------------------------------------------- /JXGradientNavigationBarExample/ScreenShot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swordray/JXGradientNavigationBar/7e907ea120bd3d2dd47d52f4bc60121a1b2e2af3/JXGradientNavigationBarExample/ScreenShot.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Jianqiu Xiao 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JXGradientNavigationBar 2 | 3 | Custom UINavigationBar subclass with gradient colors on iOS. 4 | 5 | [![Version](https://img.shields.io/cocoapods/v/JXGradientNavigationBar.svg?style=flat)](http://cocoapods.org/pods/JXGradientNavigationBar) 6 | [![License](https://img.shields.io/cocoapods/l/JXGradientNavigationBar.svg?style=flat)](http://cocoapods.org/pods/JXGradientNavigationBar) 7 | [![Platform](https://img.shields.io/cocoapods/p/JXGradientNavigationBar.svg?style=flat)](http://cocoapods.org/pods/JXGradientNavigationBar) 8 | 9 | ## Screen Shot 10 | 11 | ![Screen Shot](JXGradientNavigationBarExample/ScreenShot.png) 12 | 13 | ## Requirements 14 | 15 | - iOS SDK 7.0 or later 16 | - [CocoaPods](http://cocoapods.org) 17 | 18 | ## Installation 19 | 20 | Add the following line to your Podfile: 21 | 22 | ```ruby 23 | pod "JXGradientNavigationBar" 24 | ``` 25 | 26 | ## Usage 27 | 28 | 1. Import the header file: 29 | 30 | ```objective-c 31 | #import "JXGradientNavigationBar.h" 32 | ``` 33 | 34 | 2. Set the gradient colors using UIAppearance `barTintGradientColors` property: 35 | 36 | ```objective-c 37 | [JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]]; 38 | ``` 39 | 40 | 3. Customize your navigation controller: 41 | 42 | ```objective-c 43 | UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil]; 44 | ``` 45 | 46 | ## Example 47 | 48 | ```objective-c 49 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 50 | { 51 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 52 | 53 | [JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]]; 54 | [JXGradientNavigationBar appearance].shadowImage = [[UIImage alloc] init]; 55 | [JXGradientNavigationBar appearance].tintColor = [UIColor whiteColor]; 56 | [JXGradientNavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 57 | 58 | UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil]; 59 | navigationController.navigationBar.translucent = YES; 60 | navigationController.viewControllers = @[[[UIViewController alloc] init]]; 61 | 62 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 63 | [self.window setRootViewController:navigationController]; 64 | [self.window makeKeyAndVisible]; 65 | 66 | return YES; 67 | } 68 | ``` 69 | 70 | ## Sponsors 71 | 72 | * [BaiLu ShuYuan](https://bailushuyuan.org) 73 | 74 | ## License 75 | 76 | Copyright © 2015 Jianqiu Xiao under The [MIT License](http://opensource.org/licenses/MIT). 77 | --------------------------------------------------------------------------------