Tengo un problema en la conversión UIColor de color hexadecimal, aquí lo que encontrécolor hexadecimal de UIColor
CGColorRef colorref = [[Colorview_ backgroundColor] CGColor];
int numComponents = CGColorGetNumberOfComponents(colorref);
if (numComponents == 4) {
const CGFloat *components = CGColorGetComponents(colorref);
int hexValue = 0xFF0000*components[0] + 0xFF00*components[1] + 0xFF*components[2];
NSString *hexString = [NSString stringWithFormat:@"#%d", hexValue];
}
este código me está dando # 5576149 (por ejemplo) para HexString, nosotros vemos que hay 7 dígitos no 6, no es un color hexadecimal, cualquier ayuda será apreciada, gracias.
puede utilizar esta biblioteca https: // github .com/burhanuddin353/TFTColor –