Commit c7311b07968be71e07d481c0a8f93f2695f958cd

Authored by yanglingyu
1 parent 417ad66a

灰度,上色调节

CNLiveScioLive.xcodeproj/project.pbxproj
... ... @@ -13,6 +13,7 @@
13 13 080AB4C8217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; };
14 14 0816B5E42648C23A005E1F8C /* UIColor+CNGray.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816B5E32648C23A005E1F8C /* UIColor+CNGray.m */; };
15 15 0816B5E92648C320005E1F8C /* WKWebView+CNGray.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816B5E82648C320005E1F8C /* WKWebView+CNGray.m */; };
  16 + 0836125A264BA2BF00A18E52 /* UILabel+CNGray.m in Sources */ = {isa = PBXBuildFile; fileRef = 08361259264BA2BF00A18E52 /* UILabel+CNGray.m */; };
16 17 083847E1215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; };
17 18 083847E2215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; };
18 19 083847E3215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; };
... ... @@ -740,6 +741,8 @@
740 741 0816B5E32648C23A005E1F8C /* UIColor+CNGray.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIColor+CNGray.m"; sourceTree = "<group>"; };
741 742 0816B5E72648C320005E1F8C /* WKWebView+CNGray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WKWebView+CNGray.h"; sourceTree = "<group>"; };
742 743 0816B5E82648C320005E1F8C /* WKWebView+CNGray.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "WKWebView+CNGray.m"; sourceTree = "<group>"; };
  744 + 08361258264BA2BF00A18E52 /* UILabel+CNGray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UILabel+CNGray.h"; sourceTree = "<group>"; };
  745 + 08361259264BA2BF00A18E52 /* UILabel+CNGray.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UILabel+CNGray.m"; sourceTree = "<group>"; };
743 746 083847DF215C5DDD00186618 /* VPImageCropperViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPImageCropperViewController.h; sourceTree = "<group>"; };
744 747 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VPImageCropperViewController.m; sourceTree = "<group>"; };
745 748 0838483C215C838B00186618 /* CNLiveENTabBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveENTabBarController.h; sourceTree = "<group>"; };
... ... @@ -2252,6 +2255,8 @@
2252 2255 0816B5E32648C23A005E1F8C /* UIColor+CNGray.m */,
2253 2256 0816B5E72648C320005E1F8C /* WKWebView+CNGray.h */,
2254 2257 0816B5E82648C320005E1F8C /* WKWebView+CNGray.m */,
  2258 + 08361258264BA2BF00A18E52 /* UILabel+CNGray.h */,
  2259 + 08361259264BA2BF00A18E52 /* UILabel+CNGray.m */,
2255 2260 );
2256 2261 path = ImageGray;
2257 2262 sourceTree = "<group>";
... ... @@ -2840,6 +2845,7 @@
2840 2845 isa = PBXSourcesBuildPhase;
2841 2846 buildActionMask = 2147483647;
2842 2847 files = (
  2848 + 0836125A264BA2BF00A18E52 /* UILabel+CNGray.m in Sources */,
2843 2849 08B5C5822153400700F5476E /* CNNewsoundBaseModel.m in Sources */,
2844 2850 08585DB5215B4DA300FC2CA2 /* CNLiveAdvancedSearchViewController.m in Sources */,
2845 2851 08C28A30263932960065B372 /* UIImageView+CNGrayImage.m in Sources */,
... ...
CNLiveScioLive/AppDelegate.m
... ... @@ -102,11 +102,18 @@
102 102 [XWHTTPTool GET:urlStr params:parameters success:^(id json) {
103 103 NSDictionary *dic = [NSDictionary dictionaryWithDictionary:json];
104 104 NSURL *url = [NSURL URLWithString:dic[@"data"][@"image"]];
105   - if ([dic[@"data"][@"grayMode"] isEqualToString:@"true"]) {
  105 + NSString * mode = dic[@"grayMode"];
  106 + if (mode.intValue == 1) {
106 107 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:ISGRAYMODE];
107 108 }else{
108 109 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:ISGRAYMODE];
109 110 }
  111 + if (dic[@"homeTitleColor"]&&![dic[@"homeTitleColor"] isEqualToString:@""]) {
  112 + [[NSUserDefaults standardUserDefaults] setValue:dic[@"homeTitleColor"] forKey:HOMETITLECOLOR];
  113 + }else
  114 + {
  115 + [[NSUserDefaults standardUserDefaults] setValue:nil forKey:HOMETITLECOLOR];
  116 + }
110 117 NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"lanchImage"];
111 118 if (data.length<=0) {
112 119 [self addRootViewController];
... ...
CNLiveScioLive/Pages/Header/PrefixHeader.pch
... ... @@ -83,6 +83,7 @@
83 83 #import "UIImageView+CNGrayImage.h"
84 84 #import "UIColor+CNGray.h"
85 85 #import "WKWebView+CNGray.h"
  86 +#import "UILabel+CNGray.h"
86 87 //友盟统计
87 88 #import <UMCommon/MobClick.h>
88 89 #import <UMCommon/UMConfigure.h>
... ...
CNLiveScioLive/Pages/Header/SystemMacro.h
... ... @@ -99,7 +99,9 @@ NO)
99 99 #define ExitSuccessful @"ExitSuccessful"
100 100 #define GetCodeSuccessful @"GetCodeSuccessful"
101 101 #define ISGRAYMODE @"isGrayMode"
  102 +#define HOMETITLECOLOR @"homeTitleColor"
102 103  
  104 +#define HOMETITLECOLORSTR [[NSUserDefaults standardUserDefaults] valueForKey:HOMETITLECOLOR]
103 105 //图片
104 106 #define Image(image) [UIImage imageNamed:image]
105 107  
... ...
CNLiveScioLive/Pages/Home/CNHomeViewController.m
... ... @@ -9,6 +9,7 @@
9 9 #import "CNHomeViewController.h"
10 10 #import "XLSlideMenu.h"
11 11 #import "CNHomeModel.h"
  12 +#import "ZXWKitConst.h"
12 13  
13 14 #import "CNLiveHeraldedNewsViewController.h"
14 15 #import "CNLiveReporterAskedViewController.h"
... ... @@ -93,9 +94,16 @@
93 94 }
94 95 if(controllers.count > 0){
95 96 self.segmentControl.titles = titles;
96   - if (ininavArray[0][@"textColor"]) {
  97 + if (HOMETITLECOLORSTR) {
  98 + self.segmentControl.titleNormalColor = segementColor_title_color;
  99 + self.segmentControl.titleSelectColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  100 + [self.segmentControl setBottomViewColor:[UIColor colorWithHexString:HOMETITLECOLORSTR]];
  101 + }else{
  102 + if (ininavArray[0][@"textColor"]&&![ininavArray[0][@"textColor"] isEqualToString:@""]) {
  103 +
97 104 self.segmentControl.titleSelectColor = [UIColor colorWithHexString:ininavArray[0][@"textColor"]];
98   - [self.segmentControl setBottomViewColor:[UIColor colorWithHexString:ininavArray[0][@"textColor"]]];
  105 + [self.segmentControl setBottomViewColor:[UIColor colorWithHexString:ininavArray[0][@"textColor"]]];
  106 + }
99 107 }
100 108 self.segmentControl.viewControllers = controllers;
101 109 }
... ...
CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsLeftPicTableViewCell.m
... ... @@ -83,8 +83,13 @@
83 83 if (model.titleColor) {
84 84 _titleLabel.textColor = [UIColor colorWithHexString:model.titleColor];
85 85 }
86   - if (model.tagsColor) {
  86 + if (HOMETITLECOLORSTR) {
  87 + _projectLabel.backgroundColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  88 + }else{
  89 + if (model.tagsColor) {
  90 +
87 91 _projectLabel.backgroundColor = [UIColor colorWithHexString:model.tagsColor];
  92 + }
88 93 }
89 94 //专题
90 95 if(model.tags && ![model.tags isEqualToString:@""]){
... ...
CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsNoPicTableViewCell.m
... ... @@ -66,8 +66,13 @@
66 66 if (model.titleColor) {
67 67 _titleLabel.textColor = [UIColor colorWithHexString:model.titleColor];
68 68 }
69   - if (model.tagsColor) {
  69 +
  70 + if (HOMETITLECOLORSTR) {
  71 + _projectLabel.backgroundColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  72 + }else{
  73 + if (model.tagsColor) {
70 74 _projectLabel.backgroundColor = [UIColor colorWithHexString:model.tagsColor];
  75 + }
71 76 }
72 77 _timeLabel.text = [model.createDate componentsSeparatedByString:@" "][0];
73 78  
... ...
CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsThreePicTableViewCell.m
... ... @@ -97,8 +97,12 @@
97 97 if (model.titleColor) {
98 98 _titleLabel.textColor = [UIColor colorWithHexString:model.titleColor];
99 99 }
100   - if (model.tagsColor) {
  100 + if (HOMETITLECOLORSTR) {
  101 + _projectLabel.backgroundColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  102 + }else{
  103 + if (model.tagsColor) {
101 104 _projectLabel.backgroundColor = [UIColor colorWithHexString:model.tagsColor];
  105 + }
102 106 }
103 107 [_leftImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
104 108 [_picImage sd_setImageWithURL:[NSURL URLWithString:model.imgSmall] placeholderImage:[UIImage imageNamed:@"placeholder"]];
... ...
CNLiveScioLive/Pages/Live/Controller/TopNoticeViewController.m
... ... @@ -60,7 +60,6 @@
60 60 [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
61 61 return;
62 62 }
63   - [AlertViewTool showHUDView];
64 63  
65 64 AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
66 65 manager.responseSerializer = [AFHTTPResponseSerializer serializer];
... ...
CNLiveScioLive/Pages/Live/View/CNLiveHeaderView.m
... ... @@ -7,6 +7,7 @@
7 7 //
8 8  
9 9 #import "CNLiveHeaderView.h"
  10 +#import "UIColor+CNGray.h"
10 11 #import "CNLiveModel.h"
11 12  
12 13 @interface CNLiveHeaderView()
... ... @@ -41,7 +42,13 @@
41 42 _stateLabel.numberOfLines = 1;
42 43 _stateLabel.lineBreakMode = NSLineBreakByTruncatingTail;
43 44 _stateLabel.textColor = [UIColor whiteColor];
  45 + if ([[NSUserDefaults standardUserDefaults] boolForKey:ISGRAYMODE]) {
  46 + _stateLabel.backgroundColor = [UIColor grayColor];
  47 + }else if (HOMETITLECOLORSTR){
  48 + _stateLabel.backgroundColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  49 + }else{
44 50 _stateLabel.backgroundColor = [UIColor redColor];
  51 + }
45 52 _stateLabel.font = [UIFont systemFontOfSize:13];
46 53 _stateLabel.layer.masksToBounds = YES;
47 54 _stateLabel.layer.cornerRadius = 2;
... ...
CNLiveScioLive/Pages/Tools/ImageGray/UILabel+CNGray.h 0 → 100644
  1 +//
  2 +// UILabel+CNGray.h
  3 +// CNLiveScioLive
  4 +//
  5 +// Created by CNLive on 2021/5/12.
  6 +// Copyright © 2021 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface UILabel (CNGray)
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
... ...
CNLiveScioLive/Pages/Tools/ImageGray/UILabel+CNGray.m 0 → 100644
  1 +//
  2 +// UILabel+CNGray.m
  3 +// CNLiveScioLive
  4 +//
  5 +// Created by CNLive on 2021/5/12.
  6 +// Copyright © 2021 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "UILabel+CNGray.h"
  10 +#import "UIColor+CNGray.h"
  11 +#import "ZXWKitConst.h"
  12 +
  13 +@implementation UILabel (CNGray)
  14 ++(void)load
  15 +{
  16 + static dispatch_once_t onceToken;
  17 + dispatch_once(&onceToken, ^{
  18 + Method setImage = class_getInstanceMethod(self,@selector(setTextColor:));
  19 + Method xmtSwizzledSetImage = class_getInstanceMethod(self,@selector(cn_setTextColor:));
  20 + ///交换IMP
  21 + method_exchangeImplementations(setImage, xmtSwizzledSetImage);
  22 + });
  23 +}
  24 +-(void)cn_setTextColor:(UIColor *)textColor{
  25 + if (HOMETITLECOLORSTR) {
  26 + if (![textColor isEqual:[UIColor whiteColor]]&&![textColor isEqual:segementColor_title_color]) {
  27 + textColor = [UIColor colorWithHexString:HOMETITLECOLORSTR];
  28 +
  29 + }
  30 + }
  31 + [self cn_setTextColor:textColor];
  32 +}
  33 +
  34 +@end
... ...
CNLiveScioLive/Pages/Tools/ZXWSegmentControl/ZXWKitConst.h
... ... @@ -28,7 +28,7 @@
28 28 #define segementTitleNormalFont [UIFont systemFontOfSize:16]
29 29  
30 30 // 设置标题文本颜色(LBSegementView)
31   -#define segementColor_title_color [UIColor colorWithRed:180 / 255.0 green:149 / 255.0 blue:111 / 255.0 alpha:1.0]
  31 +#define segementColor_title_color [UIColor colorWithRed:52 / 255.0 green:52 / 255.0 blue:52 / 255.0 alpha:1.0]
32 32  
33 33 // 设置标题文本选中颜色(LBSegementView)
34 34 #define segementColor_title_select_color [UIColor colorWithRed:130 / 255.0 green:79 / 255.0 blue:15 / 255.0 alpha:1.0]
... ...