From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/Pods/RGB/RGBClassess/RRGB.m | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/RGB/RGBClassess/RRGB.m b/screendisplay/Pods/RGB/RGBClassess/RRGB.m new file mode 100755 index 0000000..46ff4cc --- /dev/null +++ b/screendisplay/Pods/RGB/RGBClassess/RRGB.m @@ -0,0 +1,27 @@ +// +// RRGB.m +// RGB +// +// Created by roycms on 2016/10/19. +// Copyright �� 2016��� roycms. All rights reserved. +// + +#import "RRGB.h" +@implementation RRGB + ++ (UIColor *)colorWithRGB16:(int)rgb { + return [UIColor colorWithRed:((rgb & 0xFF0000) >> 16) / 255.0f + green:((rgb & 0xFF00) >> 8) / 255.0f + blue:((rgb & 0xFF)) / 255.0f + alpha:1.0f]; +} ++ (UIColor *)colorWithRGBFromString:(NSString *)rgb { + if ([rgb rangeOfString:@"#"].location != NSNotFound) { + rgb = [rgb substringFromIndex:1]; + } + rgb = [NSString stringWithFormat:@"0x%@",rgb]; + unsigned long rgb16 = strtoul([rgb UTF8String],0,16); + + return [self colorWithRGB16:(int)rgb16]; +} +@end -- Gitblit v1.8.0