0

I have 2 Views, the first named "InterfaceController", and second named "LoginController". On LoginController, I have a button "Connexion", and I want when I click on this one, I'd like the button I called "TEST" be hidden.

So I tried : Interfacecontroller.h :

@interface InterfaceController : UIViewController {
- (IBAction)TEST:(id)sender;
- (IBAction)LoginSwitch:(id)sender;
}

Logincontroller.h :

@interface LoginController : UIViewController {
}
- (IBAction)Connexion:(id)sender;
@end

Logincontroller.m :

#import "InterfaceController.h"
#import "LoginController.h"
@implementation LoginViewController

- (IBAction)Connexion:(id)sender {
        [self dismissModalViewControllerAnimated:YES]; 
        InterfaceController.TEST.hidden = YES; (this is what I want to set)
}

.........

I don't really know how to do this, but I think it's easy. Somebody can explain me ?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Tom John
  • 99
  • 1
  • 7
  • where is the TEST button declaration ?!! and those are 2 viewcontrollers not just 2 ,, and in order to access methods or properties you need a delegate,,, see this question [HERE](http://stackoverflow.com/questions/1658433/accessing-method-from-other-classes-objective-c) – M.Othman Nov 11 '12 at 10:12

1 Answers1

0

You have to add an outlet of test button in interfaceController.h:

@property (nonatomic,strong) IBOutlet UIButton *TEST;

after that in Interface Builder you have to link this Outlet to the Test Button.

At this point your code works

Giuseppe Mosca
  • 1,323
  • 12
  • 18