Created
May 17, 2012 12:14
-
-
Save abrahamjso/2718516 to your computer and use it in GitHub Desktop.
Views iOS example3
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
UIButton *boton = [[UIButton alloc] initWithFrame:CGRectMake(20, 100, 100, 50)]; //Creamos nuestro boton con las medidas dadas | |
[boton addTarget:self action:@selector(hola:) forControlEvents: UIControlEventTouchDown]; | |
//Al boton le agregados metodo que al pulsar mandara llamar al metodo hola | |
[boton setTitle:@"Boton" forState:UIControlStateNormal]; //El boton tendra como titulo Boton y tendra un estado normal (parecera como un label) | |
boton.backgroundColor = [UIColor blackColor]; //Le agregamos un colo negro de fondo, si no le agregamos esto nuestro boton parecera un label como ya mencionado(yo lo puse asi para diferenciarlo). | |
[boton setTitleColor: [UIColor whiteColor] forState: UIControlStateNormal]; //Le agregamos un color a nuestro titulio | |
[ventanaFondo addSubview:boton]; //Agregamos el boton a la vistaFondo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment