Сборка Ваше собственное средство отслеживания ошибки? Для почему бы не создания собственного почтового клиента, инструмента управления проектами, и т.д.
Как , Omer van Kloeten говорит в другом месте, плата теперь, или заплатите позже.
Для чего вы хотите это сделать? Взгляните на общий метод -desciption
для начала
UIColor* someColor = ...//Initialize color
NSString* colorString = [someColor description];
Как насчет этого:
- (NSString *)stringForColor:(UIColor *)color {
CGColorRef c = color.CGColor;
const CGFloat *components = CGColorGetComponents(c);
size_t numberOfComponents = CGColorGetNumberOfComponents(c);
NSMutableString *s = [[[NSMutableString alloc] init] autorelease];
[s appendString:@"{"];
for (size_t i = 0; i < numberOfComponents; ++i) {
if (i > 0) {
[s appendString:@","];
}
[s appendString:[NSString stringWithFormat:@"%f", components[i]]];
}
[s appendString:@"}"];
return s;
}
Например, stringForColor: [UIColor greenColor]
имеет результат «{0.000000,1.000000,0.000000,1.000000}».
UIColor *color = value;
const CGFloat *components = CGColorGetComponents(color.CGColor);
NSString *colorAsString = [NSString stringWithFormat:@"%f,%f,%f,%f", components[0], components[1], components[2], components[3]];
Готово.
Если вы хотите преобразовать строку обратно в объект UIColor:
NSArray *components = [colorAsString componentsSeparatedByString:@","];
CGFloat r = [[components objectAtIndex:0] floatValue];
CGFloat g = [[components objectAtIndex:1] floatValue];
CGFloat b = [[components objectAtIndex:2] floatValue];
CGFloat a = [[components objectAtIndex:3] floatValue];
UIColor *color = [UIColor colorWithRed:r green:g blue:b alpha:a];
Сохраняете ли вы объект UIColor как атрибут в Core Data? Если да, ознакомьтесь с моим ответом на этот вопрос: Модель данных Core Data: тип атрибута для UIColor