封装设置color

本文深入探讨了使用Objective-C进行iOS应用开发的技巧与最佳实践,涵盖了从基本概念到高级特性,包括但不限于:面向对象编程、框架使用、性能优化、内存管理等关键知识点。通过丰富的实例和代码示例,旨在帮助开发者提高应用开发效率,打造高质量的iOS应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#define UIColorFromRGB_dec(r,g,b) [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:1.f]

#define UIColorFromRGBA_dec(r,g,b,a) [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:a]

#define UIColorFromRGB_hex(rgbValue) [UIColor \

colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \

green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \

blue:((float)(rgbValue & 0x0000FF))/255.0 \

alpha:1.0]


#define UIColorFromRGBA_hex(rgbValue, alphaValue) [UIColor \

colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \

green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \

blue:((float)(rgbValue & 0x0000FF))/255.0 \

alpha:alphaValue]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值