123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- //
- // UINavigationBar+Extesion.m
- // LiveChat
- //
- // Created by 张灿 on 2018/4/21.
- // Copyright © 2018年 caicai. All rights reserved.
- //
- #import "UINavigationBar+Extesion.h"
- @implementation UINavigationBar (Extesion)
- - (void)setClearBar{
- self.translucent = YES;
- [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)]];
- [self.standardAppearance setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)]];
- }
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setPupleGradientBar{
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[HexColorFromRGB(0xd975ff),HexColorFromRGB(0x744df8)] ByGradientType:(GradientLeftToRight)];
- [self setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setBlueGradientBar{
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[LCGradientOneColor,LCGradientTwoColor] ByGradientType:GradientLeftToRight];
- [self setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setPinkGradientBar
- {
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[ZYShadeOneColor,ZYShadeTwoColor] ByGradientType:GradientLeftToRight];
- [self setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- [self setTitleTextAttributes:textAttrs];
-
- }
- - (void)setPureColorGradientBar{
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[HexColorFromRGB(0xF66DDF),HexColorFromRGB(0xF66DDF)] ByGradientType:GradientLeftToRight];
- [self setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setDefaultBar{
- self.translucent = NO;
- UIImage *img = [UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(KScreenWidth, NavBarHeight)];
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = LZ273145Color;
- textAttrs[NSFontAttributeName] = LCBFont17;
- if (@available(iOS 15.0, *)) {
- self.scrollEdgeAppearance.titleTextAttributes = textAttrs;
- self.standardAppearance.titleTextAttributes = textAttrs;
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setBrownBar
- {
- self.translucent = NO;
- UIImage *img = [UIImage imageWithColor:HexColorFromRGB(0xB7958C) size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- // NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- // textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- // textAttrs[NSFontAttributeName] = LCBFont17;
- // [self setTitleTextAttributes:textAttrs];
-
- }
- - (void)setBlackBar
- {
- self.translucent = NO;
- UIImage *img = [UIImage imageWithColor:HexColorFromRGB(0x1C1D23) size:CGSizeMake(KScreenWidth, NavBarHeight)];
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- textAttrs[NSFontAttributeName] = LCBFont17;
- if (@available(iOS 15.0, *)) {
- self.scrollEdgeAppearance.titleTextAttributes = textAttrs;
- self.standardAppearance.titleTextAttributes = textAttrs;
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- [self setTitleTextAttributes:textAttrs];
- }
- - (void)setBlackBar1
- {
- self.translucent = NO;
- UIImage *img = [UIImage imageWithColor:HexColorFromRGB(0x000000) size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- // NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- // textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
- // textAttrs[NSFontAttributeName] = LCBFont17;
- // [self setTitleTextAttributes:textAttrs];
- }
- -(void)setGoldGradientBar
- {
- self.translucent = NO;
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[HexColorFromRGB(0xFFD984),HexColorFromRGB(0xC4974B)] ByGradientType:(GradientTopToBottom)];
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- }
- -(void)setGrayGradientBar
- {
- self.translucent = NO;
- UIImage *img = [LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[HexColorFromRGB(0x7A767E),HexColorFromRGB(0x6F6C73)] ByGradientType:(GradientTopToBottom)];
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- }
- - (void)setFaintYellowBar
- {
- self.translucent = NO;
- UIImage *img = [UIImage imageWithColor:HexColorFromRGB(0xFCF8F1) size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.scrollEdgeAppearance setBackgroundImage:img];
- [self.standardAppearance setBackgroundImage:img];
- }
- }
- - (void)setFaintGrayBar
- {
- self.translucent = NO;
- [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGB(0xF6F6F6) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- }
- - (void)setFaintOrangeBar
- {
- self.translucent = NO;
- [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGB(0xFFF6F4) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- }
- ///// 子爵
- //- (void)setViscountBar{
- // self.translucent = NO;
- // [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0x5669EF,0.06f) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- //}
- ///// 伯爵
- //- (void)setEarlBar{
- // self.translucent = NO;
- // [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xFFB39A,0.06f) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- //}
- ///// 公爵
- //- (void)setDukeBar{
- // self.translucent = NO;
- // [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xFF6DBB,0.06f) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- //}
- ///// 国王
- //- (void)setKingBar{
- // self.translucent = NO;
- // [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xFF6DBB,0.06f) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- //}
- ///// 皇帝
- //- (void)setEmperorBar{
- // self.translucent = NO;
- // [self setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xFF6DBB,0.06f) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- //}
- @end
|