Ok i have edited my original post.
Questions was: I have a button that once clicked 3 other button names will change.
from sin to sin-1
from cos to cos-1
from tan to tan-1
As you can tell i am doing a scientific calculator. So far i have declared a IBAtion in .h and now i am implementing this in .m
CODE CORRECTED. for future reference for others.
controller .h
IBOutlet UIButton *btn1;
IBOutlet UIButton *btn2;
IBOutlet UIButton *btn3;
controller .m
-(IBAction)buttonChangeText:(UIButton *)sender
{
[btn1 setTitle:@"sin-1" forState:UIControlStateNormal];
[btn2 setTitle:@"cos-1" forState:UIControlStateNormal];
[btn3 setTitle:@"tan-1" forState:UIControlStateNormal];
}
This will help you to understand, please go with the sender, and use the tag for the button. I will make sense to you. thanks.
- (IBAction)changeTheOtherButton:(id)sender {
if ([sender tag] == 1) {
[btn1 setTitle:@"Btn 2" forState:UIControlStateNormal];
}
else if ([sender tag] == 2) {
[btn2 setTitle:@"Btn 1" forState:UIControlStateNormal];
}
}
enjoy Coding....