I change a UIButton's parameter in ClassB, but UIButton is declared in the ClassA. How do I do see from ClassB?
Simply:
_closeButton.alpha = 1;
_closeButton.enabled = TRUE;
Thanks for reply!!
ok I have tried this: in ClassB.h
ClassA *_closeButtonController;
in ClassB.m didLoad:
_closeButtonController = [[ClassA alloc] initWithNibName:@"ClassA" bundle:nil]; _closeButtonController._closeButton.enabled = TRUE; _closeButtonController._closeButton.alpha = 1;
I haven't error but dont' work!
@Warkst in ClassA.h I have delcared @property (nonatomic, retain) IBOutlet UIButton *_closeButton; and in ClassA.m @synthesize _closeButton; Use the underscore everywhere !
I have resolved with this code: in ClassA.m
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAndEnableCloseButton) name:@"EnableCloseButton" object:nil];
}
....
- (void)showAndEnableCloseButton
{
_closeButton.alpha = 1;
_closeButton.enabled = YES;
}
In ClassB.m When "TouchUpInside" UIButton, close the View of ClassB and return on view of ClassA and call means NSNotificationCenter the changes in _closeButton of ClassA:
- (IBAction)close:(id)sender
{
[[NSNotificationCenter defaultCenter]postNotificationName:@"EnableCloseButton" object:self];
[self.view removeFromSuperview];
}
I hope I was of help to someone, Thank you all for your responses! Good Day!