Created
May 17, 2012 12:00
-
-
Save abrahamjso/2718425 to your computer and use it in GitHub Desktop.
Views iOS example
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
-(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