I have defined a color palette I want to access routinely as UIColor objects, 
but I am not convinced I am taking the right approach, particularly in regard 
to managing memory and minimizing memory used. I have defined a bunch of colors 
as follows, and am wondering if there is a better way to do this ?  Newbie 
question for sure.

//
//  ConstantsColors.h

#import <UIKit/UIKit.h>

@interface ConstantsColors : NSObject {
}

+(UIColor *)myColorGrayA;
+(UIColor *)myColorGrayB;
....etc...
@end

//
//  ConstantsColors.m

#import "ConstantsColors.h"

@implementation ConstantsColors

+(UIColor *)myColorGrayA
{
UIColor* myColorGrayA;
myColorGrayA = [UIColor colorWithRed:150.0/255.0 green:150.0/255.0 
blue:150.0/255.0 alpha:1.0];
return myColorGrayA;
}

+(UIColor *)myColorGrayB
{
UIColor* myColorGrayB;
myColorGrayB = [UIColor colorWithRed:200.0/255.0 green:200.0/255.0 
blue:200.0/255.0 alpha:1.0];
return myColorGrayB;
}


-(void) dealloc
{
[super dealloc];
}

@end

// then, in a consumer class...
// 

#import "ConstantsColors.h"

....
aViewA.backgroundColor = [ConstantsColors myColorGrayA];
....
aViewB.backgroundColor = [ConstantsColors myColorGrayB];
thanks for any help...



      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to