UIColor之【扩展:#FFFFFF -UIColor】
生活随笔
收集整理的這篇文章主要介紹了
UIColor之【扩展:#FFFFFF -UIColor】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
+(UIColor*)colorWithHexString:(NSString *)hexColor{if ([hexColor length] == 7 && [hexColor hasPrefix:@"#"]) {unsigned int red, green, blue;NSRange range;range.length = 2;range.location = 1;[[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&red];range.location = 3;[[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&green];range.location = 5;[[NSScanner scannerWithString:[hexColor substringWithRange:range]]scanHexInt:&blue];return [UIColor colorWithRed:((float)red/255.0f) green:((float)green/255.0f) blue:((float)blue/255.0f) alpha:1.0f];}return [UIColor clearColor]; }轉載于:https://my.oschina.net/u/2462423/blog/507760
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的UIColor之【扩展:#FFFFFF -UIColor】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux下定时任务不能执行
- 下一篇: ActiveMQ 部署及发送接收消息