Cambiar texto o fondo de UIButton después de un toque
Intento cambiar el aspecto de los 3 botones (títuloLable + fondo) y el texto de un TextView en los dependientes del clic en uno de los 3 botones. (Algo como contenido tabulado)
He creado los 4 elementos en el xib y los he vinculado con .h:
IBOutlet UIButton *buttonTab1;
IBOutlet UIButton *buttonTab2;
IBOutlet UIButton *buttonTab3;
IBOutlet UITextView *thisDescription;
- (IBAction)showTab1:(id)sender;
- (IBAction)showTab2:(id)sender;
- (IBAction)showTab3:(id)sender;
@property (strong, nonatomic) IBOutlet UIButton *buttonTab1;
@property (strong, nonatomic) IBOutlet UIButton *buttonTab2;
@property (strong, nonatomic) IBOutlet UIButton *buttonTab3;
en el .m trato de cambiar los 4 Elementos (aquí el código para el Botón 1):
@synthesize buttonTab1, buttonTab2, buttonTab3;
- (IBAction)showTab1:(id)sender{
thisDescription.text = [NSString stringWithFormat:@"INHALT TAB 1: %@",transferDescription];
buttonTab1.imageView.image = [UIImage imageNamed:@"content_tab1_on.png"];
buttonTab2.imageView.image = [UIImage imageNamed:@"content_tab2.png"];
buttonTab3.imageView.image = [UIImage imageNamed:@"content_tab3.png"];
buttonTab1.titleLabel.text = @"Tab1on";
buttonTab2.titleLabel.text = @"Tab2";
buttonTab3.titleLabel.text = @"Tab3";
}
El texto de TextViewElement cambia bien, pero el título y el fondo son los mismos que en el xib.