Skip to content

Instantly share code, notes, and snippets.

@C4Examples
Created July 30, 2012 17:30
Show Gist options
  • Select an option

  • Save C4Examples/3208557 to your computer and use it in GitHub Desktop.

Select an option

Save C4Examples/3208557 to your computer and use it in GitHub Desktop.
C4 Colors
//
// C4Workspace.h
// Examples
//
// Created by Travis Kirton
//
#import "C4Workspace.h"
@interface C4WorkSpace ()
-(void)setupShapes;
-(void)setupLabels;
@end
@implementation C4WorkSpace {
C4Shape *red, *blue, *grey;
}
-(void)setup {
[self setupShapes];
[self setupLabels];
red.fillColor = C4RED;
blue.fillColor = C4BLUE;
grey.fillColor = C4GREY;
}
-(void)setupShapes {
CGRect frame = CGRectMake(0, 0, self.canvas.width*0.9f, self.canvas.height/5.0f);
red = [C4Shape rect:frame];
blue = [C4Shape rect:frame];
grey = [C4Shape rect:frame];
red.lineWidth = blue.lineWidth = grey.lineWidth = 0.0f;
red.center = CGPointMake(self.canvas.center.x, self.canvas.height/4);
blue.center = CGPointMake(self.canvas.center.x, self.canvas.height*2/4);
grey.center = CGPointMake(self.canvas.center.x, self.canvas.height*3/4);
[self.canvas addShape:red];
[self.canvas addShape:blue];
[self.canvas addShape:grey];
}
-(void)setupLabels {
C4Font *f = [C4Font fontWithName:@"ArialRoundedMTBold" size:30.0f];
C4Label *l;
l = [C4Label labelWithText:@"C4RED" font:f];
l.textColor = [UIColor whiteColor];
l.center = red.center;
[self.canvas addLabel:l];
l = [C4Label labelWithText:@"C4BLUE" font:f];
l.textColor = [UIColor whiteColor];
l.center = blue.center;
[self.canvas addLabel:l];
l = [C4Label labelWithText:@"C4GREY" font:f];
l.textColor = [UIColor whiteColor];
l.center = grey.center;
[self.canvas addLabel:l];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment