UIColor之【扩展:#FFFFFF

1+(UIColor*)colorWithHexString:(NSString *)hexColor{ 2 3 if ([hexColor length] == 7 && [hexColor hasPrefix:@"#"]) { 4 5 unsigned int red, green, blue; 6 NSRange range; 7 range.length = 2; 8 9 range.location = 1; 10 [[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&red]; 11 12 range.location = 3; 13 [[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&green]; 14 15 range.location = 5; 16 [[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&blue]; 17 18 return [UIColor colorWithRed:((float)red/255.0f) green:((float)green/255.0f) blue:((float)blue/255.0f) alpha:1.0f]; 19 } 20 return [UIColor clearColor]; 21}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

swap空间的增减方法

(1)增大swap空间去激活swap交换区:swapoff v /dev/vg00/lvswap扩展交换lv:lvextend L 10G /dev/vg00/lvswap重新生成swap交换区:mkswap /dev/vg00/lvswap激活新生成的交换区:swapon v /dev/vg00/lvswap

UIWebView背景透明的方法

1.首先UIWebView背景透明//setbackgroundtransparent,alsocansetitinnibfilewebView\_.backgroundColor  \UIColor clearColor\; webView\_.opaque  NO;2.隐藏拖拽webview时上下的两个有阴影效果的su

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )