Created
April 8, 2013 20:03
-
-
Save C4Tutorials/5340007 to your computer and use it in GitHub Desktop.
The canvas listening to many specific objects.
This file contains 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.m | |
// Notification Tutorial | |
// | |
// Created by Travis Kirton. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
-(void)setup { | |
C4Shape *s1 = [C4Shape ellipse:CGRectMake(0, 0, 192, 192)]; | |
C4Shape *s2 = [C4Shape ellipse:s1.frame]; | |
C4Shape *s3 = [C4Shape ellipse:s1.frame]; | |
s1.center = CGPointMake(self.canvas.center.x, self.canvas.height * 0.25f); | |
s2.center = self.canvas.center; | |
s3.center = CGPointMake(self.canvas.center.x, self.canvas.height * 0.75f); | |
[self.canvas addObjects:@[s1,s2,s3]]; | |
[self listenFor:@"touchesBegan" fromObjects:@[s1,s2,s3] andRunMethod:@"react"]; | |
} | |
-(void)react { | |
self.canvas.backgroundColor = [UIColor colorWithWhite:[C4Math randomInt:100]/100.0f alpha:1.0f]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment