add 题目

This commit is contained in:
lianxiang
2018-09-11 23:05:15 +08:00
parent 86f8824e14
commit a2de9505ee
25 changed files with 711 additions and 136 deletions
+17
View File
@@ -0,0 +1,17 @@
//
// UIColor+HexColor.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HexColor)
+ (UIColor *)colorWithHex:(long)hexColor;
+ (UIColor *)colorWithHex:(long)hexColor alpha:(CGFloat)alpha;
@end
+27
View File
@@ -0,0 +1,27 @@
//
// UIColor+HexColor.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "UIColor+HexColor.h"
@implementation UIColor (HexColor)
+ (UIColor *)colorWithHex:(long)hexColor {
CGFloat red = ((CGFloat)((hexColor & 0xFF0000) >> 16))/255.0f;
CGFloat green = ((CGFloat)((hexColor & 0xFF00) >> 8))/255.0f;
CGFloat blue = ((CGFloat)(hexColor & 0xFF))/255.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];
}
+ (UIColor *)colorWithHex:(long)hexColor alpha:(CGFloat)alpha{
CGFloat red = ((CGFloat)((hexColor & 0xFF0000) >> 16))/255.0f;
CGFloat green = ((CGFloat)((hexColor & 0xFF00) >> 8))/255.0f;
CGFloat blue = ((CGFloat)(hexColor & 0xFF))/255.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
@end