ios - How to convert UIColor RGB Color to uint32_t Value -
how convert uicolor object uint32_t value. please let me know if 1 aware of this?
here code:
const cgfloat *components = cgcolorgetcomponents([uicolor redcolor].cgcolor); cgfloat r = components[0]; cgfloat g = components[1]; cgfloat b = components[2]; const uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b);
how pass 0xffffffff value in uint32_t?
const uint32_t white = 0xffffffff, black = 0xff000000, transp = 0x00ffffff;
if want convert hex-string integer value, should try this:
unsigned int outval; nsscanner* scanner = [nsscanner scannerwithstring:@"0xff000000"]; [scanner scanhexint:&outval];
Comments
Post a Comment