Cocoa Snippet

Factory

+ (BrandingFactory *) factory
{
#if defined (USE_ACME)
return [[[AcmeBrandingFactory alloc] init] autorelease];
#elif defined (USE_SIERRA)
return [[[SierraBrandingFactory alloc] init] autorelease];
#else
return nil;
#endif
}

Copy

- (id)copyWithZone:(NSZone *)zone
{
Dot *dotCopy = [[[self class] allocWithZone:zone] initWithLocation:location_];
// copy the color
[dotCopy setColor:[UIColor colorWithCGColor:[color_ CGColor]]];
// copy the size
[dotCopy setSize:size_];
return dotCopy;
}

posted on 2012-07-12 22:10  grep  阅读(165)  评论(0编辑  收藏  举报