Skip to content

Commit

Permalink
简化方法
Browse files Browse the repository at this point in the history
  • Loading branch information
songwentong committed Dec 24, 2014
1 parent a40ebd2 commit b639659
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions WTRequestCenter/UIKit+WTRequestCenter/UIColor+WTRequestCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,7 @@ + (NSUInteger)integerValueFromHexString:(NSString *)hexString {

+ (UIColor *)WTcolorWithHexString:(NSString *)str
{
if (!str || [str isEqualToString:@""]) {
return nil;
}
unsigned red,green,blue;
NSRange range;
range.length = 2;
range.location = 1;
[[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&red];
range.location = 3;
[[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&green];
range.location = 5;
[[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&blue];
UIColor *color= [UIColor colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:1];
return color;
return [self WTcolorWithHexString:str alpha:1.0];
}

+ (UIColor *)WTcolorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha {
Expand Down

0 comments on commit b639659

Please sign in to comment.