惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - 1901

试用Github Pages iOS设备内存及分辨率 测试显示GitHub的Gist 使用GTMBase64编码解码字符串 先随便记一下 iOS中获取程序相关的一些目录路径 mac字典词库增加方法 Google的Logo记现代舞先驱玛莎·葛兰姆117周年诞辰-Flash版 关于flash加载flash时的缩放和位置问题 给力壁纸 for mac 【转载】巧用宏定义来简写C,C++代码 Objective-C中的NSObject对象经常使用到的方法 Objective-C属性介绍 应用程序本地化-国家代码介绍(ISO 3166-1) iPhone开发资料 sourceMate2 我在MACOS下常用的软件 【转载】分享一些FLASH开发时用到的工具~ 关于ActionScript3中的事件类强制转换失败的问题
颜色转换工具
1901 · 2011-06-29 · via 博客园 - 1901

最近在做Objective-C的开发,发现在Objective-C中使用UIColor生成颜色需要的参数不是我们一般使用的0-255和十六进制表示方法,而是0-1的小数表示方式(如:UIColor* color = [UIColor colorWithRed:0.79 green:0.87 blue:0.91 alpha:1];),很不习惯,所以用flash写了个转换的小工具放上来以便有需要的朋友使用。

补发两个在Objective-C中取颜色的宏:

//RGB color macro
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((
float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((
float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((
float)(rgbValue & 0xFF))/255.0 alpha:1.0]//RGB color macro with alpha
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((
float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((
float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((
float)(rgbValue & 0xFF))/255.0 alpha:a]