uicolor を 16 進数の色に変換する際に問題が発生しました。
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];
}
このコードは私に #5576149 (たとえば) hexString を与えています。6 桁ではなく 7 桁であることがわかります。16 進数の色ではありません。