Created
April 8, 2013 19:57
-
-
Save C4Tutorials/5339967 to your computer and use it in GitHub Desktop.
The canvas listening to a specific object.
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 *s = [C4Shape ellipse:CGRectMake(0, 0, 192, 192)]; | |
s.center = self.canvas.center; | |
[self.canvas addShape:s]; | |
[self listenFor:@"touchesBegan" fromObject:s 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