Skip to content

Instantly share code, notes, and snippets.

@yeco
Created October 26, 2011 06:03
Show Gist options
  • Select an option

  • Save yeco/1315577 to your computer and use it in GitHub Desktop.

Select an option

Save yeco/1315577 to your computer and use it in GitHub Desktop.
Evento Touch y animación para juegos básica con Objective-C
// Asigna un nuevo view:
self.viewController = [jumpingViewController alloc];
[window addSubview:viewController.view];
#import
@interface jumpingViewController : UIViewController {
UIImageView *player;
}
@property (nonatomic, retain) UIImageView *player;
@end
- (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