JXGradientNavigationBar 0.1.2

JXGradientNavigationBar 0.1.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2022年1月

Jianqiu Xiao维护。




  • Jianqiu Xiao

JXGradientNavigationBar

在 iOS 上使用渐变颜色的自定义 UINavigationBar 子类。

Version License Platform

屏幕截图

Screen Shot

需求

安装

将以下行添加到您的 Podfile 中

pod "JXGradientNavigationBar"

用法

  1. 导入头文件
#import "JXGradientNavigationBar.h"
  1. 使用UIAppearance的barTintGradientColors属性设置渐变色。
[JXGradientNavigationBar appearance].barTintGradientColors = @[[UIColor greenColor], [UIColor yellowColor]];
  1. 自定义您的导航控制器
UINavigationController * navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[JXGradientNavigationBar class] toolbarClass:nil];

示例

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

赞助商

许可

版权所有 © 2015 肖建秋 在《MIT许可协议》下。