开发者社区 问答 正文

关于在ios中实现C++setRGB 的问题

有一个int值:RGB = 4294967295;。怎么样从这个值中设置color?在C++中使用setRGB()方法。在IOS中有没有类似的实现方法?

展开
收起
爵霸 2016-03-24 11:16:38 1777 分享 版权
1 条回答
写回答
取消 提交回答
  • float alpha = (intARGB >> 24) % 256;
    float red = (intARGB >> 16) % 256;
    float green = (intARGB >> 8) % 256;
    float blue = intARGB % 256;
    UIColor *theColor = [UIColor colorWithRed:red/255. green:green/255. blue:blue/255. alpha:alpha/255.];
    2019-07-17 19:12:23
    赞同 展开评论
问答分类:
问答标签:
问答地址: