IOS 16进制颜色字符串转UIColor
来源:互联网 发布:淘宝什么是属性词 编辑:程序博客网 时间:2024/06/05 08:48
IOS 16进制颜色字符串转UIColor
把字符串截出来就可以了
- (UIColor ) stringTOColor:(NSString )str
{
if (!str || [str isEqualToString:@”“]||str.length < 7) {
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;
}
2 0
- IOS 16进制颜色字符串转UIColor
- ios 16进制颜色转UIColor
- iOS-16进制颜色转UIColor
- 16进制颜色字符串转为UIColor
- iOS开发中16进制颜色(html颜色值)字符串转为UIColor
- ios开发之16进制颜色(html颜色值)字符串转为UIColor
- ios开发之16进制颜色(html颜色值)字符串转为UIColor
- iOS开发中16进制颜色(html颜色值)字符串转为UIColor
- iOS开发之16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 16进制颜色(html颜色值)字符串转为UIColor
- 导航菜单固定头部跟随屏幕滚动jQuery插件
- 用EmEditor替换掉Windows自带的记事本方法
- NCDC 天气数据的预处理
- install composer globally
- 地理编码
- IOS 16进制颜色字符串转UIColor
- 数据结构课程设计
- 存储过程的参数与返回值使用方法
- js设置cookie
- CenttOS的防火墙
- nginx源码解析一(main函数分析)
- 2015年年度总结 新年伊始 回眸展望
- solr5.4.0导入数据
- JTable中 表头中添加 JCheckBox 全选 反向选择 功能 CheckHeaderCellRenderer类