Created
June 3, 2013 00:09
-
-
Save drart/5695449 to your computer and use it in GitHub Desktop.
Image swapping example improved.
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.h | |
// Examples | |
// | |
// Created by Travis Kirton | |
// Modified by Adam Tindale | |
// | |
#import "C4Workspace.h" | |
@implementation C4WorkSpace { | |
//define 2 invisible images | |
C4Image *i1, *i2; | |
//define a pointer to a selected image | |
C4Image *visibleImage; | |
} | |
-(void)setup { | |
i1 = [C4Image imageNamed:@"C4Sky.png"]; | |
i2 = [C4Image imageNamed:@"C4Table.png"]; | |
visibleImage = i1; | |
i1.center = i2.center = self.canvas.center; | |
[self.canvas addImage:visibleImage]; | |
} | |
-(void)touchesBegan { | |
[self.canvas removeObject:visibleImage]; | |
if (visibleImage == i1) | |
visibleImage = i2; | |
else | |
visibleImage = i1; | |
[self.canvas addImage:visibleImage]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment