Created
October 26, 2011 06:03
-
-
Save yeco/1315577 to your computer and use it in GitHub Desktop.
Evento Touch y animación para juegos básica con Objective-C
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
| // Asigna un nuevo view: | |
| self.viewController = [jumpingViewController alloc]; | |
| [window addSubview:viewController.view]; |
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
| #import | |
| @interface jumpingViewController : UIViewController { | |
| UIImageView *player; | |
| } | |
| @property (nonatomic, retain) UIImageView *player; | |
| @end |
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
| - (void)loadView { | |
| // Asigna la vista | |
| self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; | |
| // Establece el color de fondo de la vista | |
| self.view.backgroundColor = [UIColor blackColor]; | |
| // Crea la imagen de fondo | |
| UIImageView *bg = [[UIImageView alloc] initWithFrame:CGRectMake(0 , 0, 572, 206)]; | |
| [bg setImage:[UIImage imageNamed:@"bg.jpg"]]; | |
| [self.view addSubview:bg]; | |
| // Crea el botón | |
| [self addButton]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment