advertisement

Article:
  Creating a Color Meter Using Cocoa
Subject:   awakeFromNib
Date:   2001-10-02 20:09:05
From:   rick1138
Response to: awakeFromNib

Use this code (below) that initializes the variables,displays them in the text fields,and then sets the color well accordingly.This is a useful little app for OpenGL programmers-sice RGB values are calculated from 0 to 1 like OpenGL,you can experiment with color values without having to continually type them in and recompile a full application.



- (void)awakeFromNib
{
redValue = 1.0;
blueValue = 1.0;
greenValue = 1.0;
alphaValue = 1.0;

[redField setFloatValue:redValue];
[greenField setFloatValue:greenValue];
[blueField setFloatValue:blueValue];
[alphaField setFloatValue:alphaValue];

[self updateColor];


}