删除UIColor分类
This commit is contained in:
@@ -158,7 +158,6 @@
|
|||||||
9B92A37027981F5B00AD168F /* XPSkillCardEditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A36F27981F5B00AD168F /* XPSkillCardEditViewController.m */; };
|
9B92A37027981F5B00AD168F /* XPSkillCardEditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A36F27981F5B00AD168F /* XPSkillCardEditViewController.m */; };
|
||||||
9B9EEF4E27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF4D27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m */; };
|
9B9EEF4E27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF4D27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m */; };
|
||||||
9B9EEF5427C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF5327C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m */; };
|
9B9EEF5427C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF5327C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m */; };
|
||||||
9BA41F2527CBB7950043B11F /* UIColor+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA41F2427CBB7950043B11F /* UIColor+Extension.m */; };
|
|
||||||
9BA8A47227C5D590000365A3 /* XPVoiceCardCircleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA8A47127C5D590000365A3 /* XPVoiceCardCircleLayer.m */; };
|
9BA8A47227C5D590000365A3 /* XPVoiceCardCircleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA8A47127C5D590000365A3 /* XPVoiceCardCircleLayer.m */; };
|
||||||
9BA8A47527C60D9F000365A3 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BA8A47427C60D9F000365A3 /* AudioToolbox.framework */; };
|
9BA8A47527C60D9F000365A3 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BA8A47427C60D9F000365A3 /* AudioToolbox.framework */; };
|
||||||
9BA8A47727C60DF7000365A3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BA8A47627C60DF7000365A3 /* AVFoundation.framework */; };
|
9BA8A47727C60DF7000365A3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BA8A47627C60DF7000365A3 /* AVFoundation.framework */; };
|
||||||
@@ -850,8 +849,6 @@
|
|||||||
9B9EEF4D27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardResourcePropModel.m; sourceTree = "<group>"; };
|
9B9EEF4D27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardResourcePropModel.m; sourceTree = "<group>"; };
|
||||||
9B9EEF5227C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardRecordPropModel.h; sourceTree = "<group>"; };
|
9B9EEF5227C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardRecordPropModel.h; sourceTree = "<group>"; };
|
||||||
9B9EEF5327C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardRecordPropModel.m; sourceTree = "<group>"; };
|
9B9EEF5327C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardRecordPropModel.m; sourceTree = "<group>"; };
|
||||||
9BA41F2327CBB7950043B11F /* UIColor+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Extension.h"; sourceTree = "<group>"; };
|
|
||||||
9BA41F2427CBB7950043B11F /* UIColor+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Extension.m"; sourceTree = "<group>"; };
|
|
||||||
9BA8A47027C5D590000365A3 /* XPVoiceCardCircleLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPVoiceCardCircleLayer.h; sourceTree = "<group>"; };
|
9BA8A47027C5D590000365A3 /* XPVoiceCardCircleLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPVoiceCardCircleLayer.h; sourceTree = "<group>"; };
|
||||||
9BA8A47127C5D590000365A3 /* XPVoiceCardCircleLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardCircleLayer.m; sourceTree = "<group>"; };
|
9BA8A47127C5D590000365A3 /* XPVoiceCardCircleLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardCircleLayer.m; sourceTree = "<group>"; };
|
||||||
9BA8A47427C60D9F000365A3 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
9BA8A47427C60D9F000365A3 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
||||||
@@ -2065,7 +2062,6 @@
|
|||||||
children = (
|
children = (
|
||||||
9B33E3C827D85379003B0E62 /* File */,
|
9B33E3C827D85379003B0E62 /* File */,
|
||||||
E80CBDE727D0C528001E1EC2 /* Timer */,
|
E80CBDE727D0C528001E1EC2 /* Timer */,
|
||||||
9BA41F2227CBB7500043B11F /* UIColor */,
|
|
||||||
180116F6279E8C3100F2CBC0 /* Date */,
|
180116F6279E8C3100F2CBC0 /* Date */,
|
||||||
9B17F71527BD14FF00440843 /* SVGAParserManager */,
|
9B17F71527BD14FF00440843 /* SVGAParserManager */,
|
||||||
9B8585F22788699400D7D5C6 /* KVO */,
|
9B8585F22788699400D7D5C6 /* KVO */,
|
||||||
@@ -2556,15 +2552,6 @@
|
|||||||
name = "Recovered References";
|
name = "Recovered References";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
9BA41F2227CBB7500043B11F /* UIColor */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
9BA41F2327CBB7950043B11F /* UIColor+Extension.h */,
|
|
||||||
9BA41F2427CBB7950043B11F /* UIColor+Extension.m */,
|
|
||||||
);
|
|
||||||
path = UIColor;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
9BB549632782F96F0090CD26 /* SubViews */ = {
|
9BB549632782F96F0090CD26 /* SubViews */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -5093,7 +5080,6 @@
|
|||||||
E84BF7E0277C869A00EF8877 /* XPRoomOnLineViewController.m in Sources */,
|
E84BF7E0277C869A00EF8877 /* XPRoomOnLineViewController.m in Sources */,
|
||||||
186A534826FC6ED900D67B2C /* TTAlertButtonConfig.m in Sources */,
|
186A534826FC6ED900D67B2C /* TTAlertButtonConfig.m in Sources */,
|
||||||
E8ACEFF827C9034C00F66D1A /* XPHomeListEmptyTableViewCell.m in Sources */,
|
E8ACEFF827C9034C00F66D1A /* XPHomeListEmptyTableViewCell.m in Sources */,
|
||||||
9BA41F2527CBB7950043B11F /* UIColor+Extension.m in Sources */,
|
|
||||||
E89D60BA271D643A001F8895 /* Api+Room.m in Sources */,
|
E89D60BA271D643A001F8895 /* Api+Room.m in Sources */,
|
||||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */,
|
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */,
|
||||||
E8C6FFEA2755040B004DC9F0 /* XPHomeSearchNavView.m in Sources */,
|
E8C6FFEA2755040B004DC9F0 /* XPHomeSearchNavView.m in Sources */,
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// UIColor+Extension.h
|
|
||||||
// PlanetStar
|
|
||||||
//
|
|
||||||
// Created by Runyalsj on 2020/6/16.
|
|
||||||
// Copyright © 2020 WUJIE INTERACTIVE. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface UIColor (Extension)
|
|
||||||
+ (UIColor *) colorWithHexString:(NSString *) hexString;
|
|
||||||
+ (UIColor *) colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha;
|
|
||||||
+ (NSString *) hexStringFromColor:(UIColor *)color;
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
@@ -1,102 +0,0 @@
|
|||||||
//
|
|
||||||
// UIColor+Extension.m
|
|
||||||
// PlanetStar
|
|
||||||
//
|
|
||||||
// Created by Runyalsj on 2020/6/16.
|
|
||||||
// Copyright © 2020 WUJIE INTERACTIVE. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "UIColor+Extension.h"
|
|
||||||
|
|
||||||
@implementation UIColor (Extension)
|
|
||||||
+ (UIColor *) colorWithHexString: (NSString *) hexString {
|
|
||||||
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
|
||||||
CGFloat alpha, red, blue, green;
|
|
||||||
switch ([colorString length]) {
|
|
||||||
case 3: // #RGB
|
|
||||||
alpha = 1.0f;
|
|
||||||
red = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
||||||
green = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
||||||
break;
|
|
||||||
case 4: // #ARGB
|
|
||||||
alpha = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
||||||
red = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
||||||
green = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 3 length: 1];
|
|
||||||
break;
|
|
||||||
case 6: // #RRGGBB
|
|
||||||
alpha = 1.0f;
|
|
||||||
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
||||||
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
||||||
break;
|
|
||||||
case 8: // #AARRGGBB
|
|
||||||
alpha = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
||||||
red = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
||||||
green = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 6 length: 2];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
[NSException raise:@"Invalid color value" format: @"Color value %@ is invalid. It should be a hex value of the form #RBG, #ARGB, #RRGGBB, or #AARRGGBB", hexString];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (UIColor *) colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha {
|
|
||||||
if (hexString.length == 0) return [UIColor blackColor];
|
|
||||||
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
|
||||||
CGFloat red, blue, green;
|
|
||||||
switch ([colorString length]) {
|
|
||||||
case 3: // #RGB
|
|
||||||
red = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
||||||
green = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
||||||
break;
|
|
||||||
case 4: // #ARGB
|
|
||||||
alpha = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
||||||
red = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
||||||
green = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 3 length: 1];
|
|
||||||
break;
|
|
||||||
case 6: // #RRGGBB
|
|
||||||
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
||||||
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
||||||
break;
|
|
||||||
case 8: // #AARRGGBB
|
|
||||||
alpha = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
||||||
red = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
||||||
green = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
||||||
blue = [self colorComponentFrom: colorString start: 6 length: 2];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
[NSException raise:@"Invalid color value" format: @"Color value %@ is invalid. It should be a hex value of the form #RBG, #ARGB, #RRGGBB, or #AARRGGBB", hexString];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
|
|
||||||
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
|
|
||||||
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
|
|
||||||
unsigned hexComponent;
|
|
||||||
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
|
|
||||||
return hexComponent / 255.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSString *)hexStringFromColor:(UIColor *)color {
|
|
||||||
const CGFloat *components = CGColorGetComponents(color.CGColor);
|
|
||||||
|
|
||||||
CGFloat r = components[0];
|
|
||||||
CGFloat g = components[1];
|
|
||||||
CGFloat b = components[2];
|
|
||||||
|
|
||||||
return [NSString stringWithFormat:@"#%02lX%02lX%02lX",
|
|
||||||
lroundf(r * 255),
|
|
||||||
lroundf(g * 255),
|
|
||||||
lroundf(b * 255)];
|
|
||||||
}
|
|
||||||
@end
|
|
@@ -12,7 +12,6 @@
|
|||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
#import "UIColor+Extension.h"
|
|
||||||
///Model
|
///Model
|
||||||
#import "FansInfoModel.h"
|
#import "FansInfoModel.h"
|
||||||
|
|
||||||
@@ -165,13 +164,31 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
if (fansInfo.userVipInfoVO && fansInfo.userVipInfoVO.friendNickColour) {
|
if (fansInfo.userVipInfoVO && fansInfo.userVipInfoVO.friendNickColour) {
|
||||||
self.nickLabel.textColor = [UIColor colorWithHexString:fansInfo.userVipInfoVO.friendNickColour];
|
self.nickLabel.textColor = [self colorWithHexString:fansInfo.userVipInfoVO.friendNickColour];
|
||||||
} else {
|
} else {
|
||||||
self.nickLabel.textColor = [ThemeColor mainTextColor];
|
self.nickLabel.textColor = [ThemeColor mainTextColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIColor *)colorWithHexString: (NSString *) hexString {
|
||||||
|
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
||||||
|
CGFloat alpha, red, blue, green;
|
||||||
|
alpha = 1.0f;
|
||||||
|
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
||||||
|
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
||||||
|
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
||||||
|
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
|
||||||
|
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
|
||||||
|
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
|
||||||
|
unsigned hexComponent;
|
||||||
|
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
|
||||||
|
return hexComponent / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
- (NetImageView *)avatarImageView {
|
- (NetImageView *)avatarImageView {
|
||||||
if (!_avatarImageView) {
|
if (!_avatarImageView) {
|
||||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
#import "UIColor+Extension.h"
|
|
||||||
///Model
|
///Model
|
||||||
#import "FansInfoModel.h"
|
#import "FansInfoModel.h"
|
||||||
|
|
||||||
@@ -170,13 +169,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fansInfo.userVipInfoVO && fansInfo.userVipInfoVO.friendNickColour) {
|
if (fansInfo.userVipInfoVO && fansInfo.userVipInfoVO.friendNickColour) {
|
||||||
self.nickLabel.textColor = [UIColor colorWithHexString:fansInfo.userVipInfoVO.friendNickColour];
|
self.nickLabel.textColor = [self colorWithHexString:fansInfo.userVipInfoVO.friendNickColour];
|
||||||
} else {
|
} else {
|
||||||
self.nickLabel.textColor = [ThemeColor mainTextColor];
|
self.nickLabel.textColor = [ThemeColor mainTextColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIColor *)colorWithHexString: (NSString *) hexString {
|
||||||
|
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
||||||
|
CGFloat alpha, red, blue, green;
|
||||||
|
alpha = 1.0f;
|
||||||
|
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
||||||
|
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
||||||
|
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
||||||
|
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
|
||||||
|
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
|
||||||
|
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
|
||||||
|
unsigned hexComponent;
|
||||||
|
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
|
||||||
|
return hexComponent / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
- (NetImageView *)avatarImageView {
|
- (NetImageView *)avatarImageView {
|
||||||
if (!_avatarImageView) {
|
if (!_avatarImageView) {
|
||||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
///Third
|
///Third
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import <YYImage/YYAnimatedImageView.h>
|
#import <YYImage/YYAnimatedImageView.h>
|
||||||
#import "UIColor+Extension.h"
|
|
||||||
///View
|
///View
|
||||||
#import "MicroWaveView.h"
|
#import "MicroWaveView.h"
|
||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
@@ -364,7 +363,7 @@
|
|||||||
}
|
}
|
||||||
self.nickLabel.text = nickStr.length > 0 ? nickStr : @"";
|
self.nickLabel.text = nickStr.length > 0 ? nickStr : @"";
|
||||||
if (userInfo.micNickColor.length) {
|
if (userInfo.micNickColor.length) {
|
||||||
self.nickLabel.textColor = [UIColor colorWithHexString:userInfo.micNickColor];
|
self.nickLabel.textColor = [self colorWithHexString:userInfo.micNickColor];
|
||||||
} else {
|
} else {
|
||||||
self.nickLabel.textColor = [ThemeColor positionNickColor];
|
self.nickLabel.textColor = [ThemeColor positionNickColor];
|
||||||
}
|
}
|
||||||
@@ -429,6 +428,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIColor *)colorWithHexString: (NSString *) hexString {
|
||||||
|
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
||||||
|
CGFloat alpha, red, blue, green;
|
||||||
|
alpha = 1.0f;
|
||||||
|
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
||||||
|
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
||||||
|
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
||||||
|
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
|
||||||
|
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
|
||||||
|
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
|
||||||
|
unsigned hexComponent;
|
||||||
|
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
|
||||||
|
return hexComponent / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (NetImageView *)avatarImageView {
|
- (NetImageView *)avatarImageView {
|
||||||
if (!_avatarImageView) {
|
if (!_avatarImageView) {
|
||||||
|
Reference in New Issue
Block a user