Created
July 31, 2012 03:11
-
-
Save C4Examples/3213184 to your computer and use it in GitHub Desktop.
UIColor RGBA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // C4Workspace.h | |
| // Examples | |
| // | |
| // Created by Travis Kirton | |
| // | |
| #import "C4Workspace.h" | |
| @interface C4WorkSpace () | |
| -(void)setupShapes; | |
| -(void)setupLabels; | |
| @end | |
| @implementation C4WorkSpace { | |
| C4Shape *red, *green, *blue; | |
| } | |
| -(void)setup { | |
| [self setupShapes]; | |
| [self setupLabels]; | |
| red.fillColor = [UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| green.fillColor = [UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:1.0f]; | |
| blue.fillColor = [UIColor colorWithRed:0.0f green:0.0f blue:1.0f alpha:1.0f]; | |
| } | |
| -(void)setupShapes { | |
| CGRect frame = CGRectMake(0, 0, self.canvas.width*0.9f, self.canvas.height/5.0f); | |
| red = [C4Shape rect:frame]; | |
| green = [C4Shape rect:frame]; | |
| blue = [C4Shape rect:frame]; | |
| red.lineWidth = green.lineWidth = blue.lineWidth = 0.0f; | |
| red.center = CGPointMake(self.canvas.center.x, self.canvas.height/4); | |
| green.center = CGPointMake(self.canvas.center.x, self.canvas.height*2/4); | |
| blue.center = CGPointMake(self.canvas.center.x, self.canvas.height*3/4); | |
| [self.canvas addShape:red]; | |
| [self.canvas addShape:green]; | |
| [self.canvas addShape:blue]; | |
| } | |
| -(void)setupLabels { | |
| C4Font *f = [C4Font fontWithName:@"ArialRoundedMTBold" size:30.0f]; | |
| C4Label *l; | |
| l = [C4Label labelWithText:@"{RGBA} : {1.0,0,0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = red.center; | |
| [self.canvas addLabel:l]; | |
| l = [C4Label labelWithText:@"{RGBA} : {0,1.0,0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = green.center; | |
| [self.canvas addLabel:l]; | |
| l = [C4Label labelWithText:@"{RGBA} : {0,0,1.0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = blue.center; | |
| [self.canvas addLabel:l]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment