Skip to content

Instantly share code, notes, and snippets.

@abrahamjso
Created May 17, 2012 12:00
Show Gist options
  • Save abrahamjso/2718425 to your computer and use it in GitHub Desktop.
Save abrahamjso/2718425 to your computer and use it in GitHub Desktop.
Views iOS example
-(void)ventanaCrear
{
UIView *ventanaFondo = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ventanaFondo.backgroundColor = [UIColor grayColor];
[self.view addSubview:ventanaFondo];
NSString *nombre = @"Creacion de un label";
UILabel *lnombre = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 500, 100)];
lnombre.backgroundColor = [UIColor clearColor];
lnombre.font = [lnombre.font fontWithSize:25];
lnombre.text = [NSString stringWithFormat:@"%@", nombre];
[ventanaFondo addSubview:lnombre];
UIButton *boton = [[UIButton alloc] initWithFrame:CGRectMake(20, 100, 100, 50)];
[boton addTarget:self action:@selector(hola:) forControlEvents: UIControlEventTouchDown];
[boton setTitle:@"Boton" forState:UIControlStateNormal];
boton.backgroundColor = [UIColor blackColor];
[boton setTitleColor: [UIColor whiteColor] forState: UIControlStateNormal];
[ventanaFondo addSubview:boton];
UIImageView *imagen = [[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"migesa.jpg"]]];
imagen.frame = CGRectMake(10, 200, 115, 115);
[ventanaFondo addSubview:imagen];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment