Alterar texto ou plano de fundo do UIButton após um toque
Eu tento mudar o Look of 3 Buttons (TitleLable + Background) e Text de um TextView em dependentes do clique em um dos 3 Buttons. (Algo como conteúdo com guias)
Eu criei os 4 elementos no xib e os vinculei ao .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;
no .m eu tento alterar os 4 elementos (aqui o código para o botão 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";
}
O texto do TextViewElement muda bem, mas o título e o plano de fundo são os mesmos como no xib.