https://github.com/swordray/jxgradientnavigationbar
Custom UINavigationBar subclass with gradient colors on iOS.
https://github.com/swordray/jxgradientnavigationbar
ios objective-c uinavigationbar
Last synced: about 1 year ago
JSON representation
Custom UINavigationBar subclass with gradient colors on iOS.
- Host: GitHub
- URL: https://github.com/swordray/jxgradientnavigationbar
- Owner: swordray
- License: mit
- Created: 2015-07-09T08:46:24.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-01-30T06:19:18.000Z (over 4 years ago)
- Last Synced: 2024-10-19T12:47:58.853Z (over 1 year ago)
- Topics: ios, objective-c, uinavigationbar
- Language: Objective-C
- Homepage:
- Size: 129 KB
- Stars: 18
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JXGradientNavigationBar
Custom UINavigationBar subclass with gradient colors on iOS.
[](http://cocoapods.org/pods/JXGradientNavigationBar)
[](http://cocoapods.org/pods/JXGradientNavigationBar)
[](http://cocoapods.org/pods/JXGradientNavigationBar)
## Screen Shot

## Requirements
- iOS SDK 7.0 or later
- [CocoaPods](http://cocoapods.org)
## Installation
Add the following line to your Podfile:
```ruby
pod "JXGradientNavigationBar"
```
## Usage
1. Import the header file:
```objective-c
#import "JXGradientNavigationBar.h"
```
2. Set the gradient colors using UIAppearance `barTintGradientColors` property:
```objective-c
[JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]];
```
3. Customize your navigation controller:
```objective-c
UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil];
```
## Example
```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]];
[JXGradientNavigationBar appearance].shadowImage = [[UIImage alloc] init];
[JXGradientNavigationBar appearance].tintColor = [UIColor whiteColor];
[JXGradientNavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil];
navigationController.navigationBar.translucent = YES;
navigationController.viewControllers = @[[[UIViewController alloc] init]];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window setRootViewController:navigationController];
[self.window makeKeyAndVisible];
return YES;
}
```
## Sponsors
* [BaiLu ShuYuan](https://bailushuyuan.org)
## License
Copyright © 2015 Jianqiu Xiao under The [MIT License](http://opensource.org/licenses/MIT).