I am allocating memory in the class method initialize:
UIColor * customBlue;
UIColor * customRed;
@implementation UIColorConstants
+ (void)initialize{
if ( self == [UIColorConstants class] ) {
customBlue = [[UIColor alloc]initWithRed:0 green:0.137 blue:0.584 alpha:1];
customRed = [[UIColor alloc]initWithRed:.91 green:0.067 blue:0.176 alpha:1];
}
}
+ (UIColor *)getCustomRed{
return customRed;
}
+ (UIColor *)getCustomBlue{
return customBlue;
}
@end
释放所分配记忆的最佳/正确地点何在,因为没有对方自动启动?