【发布时间】:2010-10-28 16:02:29
【问题描述】:
我在类方法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
由于没有自动调用的初始化对应物,释放分配的内存的最佳/正确位置在哪里?
【问题讨论】:
标签: iphone objective-c