Skip to content

Instantly share code, notes, and snippets.

@abrahamjso
Created May 17, 2012 12:14
Show Gist options
  • Save abrahamjso/2718516 to your computer and use it in GitHub Desktop.
Save abrahamjso/2718516 to your computer and use it in GitHub Desktop.
Views iOS example3
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