JXGradientNavigationBar 0.1.2

JXGradientNavigationBar 0.1.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jan 2022

Maintained by Jianqiu Xiao.




  • By
  • Jianqiu Xiao

JXGradientNavigationBar

Custom UINavigationBar subclass with gradient colors on iOS.

Version License Platform

Screen Shot

Screen Shot

Requirements

Installation

Add the following line to your Podfile:

pod "JXGradientNavigationBar"

Usage

  1. Import the header file:
#import "JXGradientNavigationBar.h"
  1. Set the gradient colors using UIAppearance barTintGradientColors property:
[JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]];
  1. Customize your navigation controller:
UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil];

Example

- (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

License

Copyright © 2015 Jianqiu Xiao [email protected] under The MIT License.