Can anyone enlighten me as to what I'm doing wrong. I have two ViewControllers, lets say myViewController1 and myViewController2. myViewController1 contains 2 UIViews. What I'd like to do is be able to change the hidden of one of the UIViews contained in myViewController1 from a UIButton in myViewController2.
Here is what I've tried:
Code:
-(IBAction)backToMyViewController1:(id)sender {
myViewController1 *home = [[myViewController1 alloc]
initWithNibName:@"myViewController1" bundle:nil];
[home hideHome:self]; //here I was trying to have myViewController2 call a method which is defined in myViewController1 that essentially just toggles the hidden setting of the two views. Just trying anything I thought may work.
home.view1.hidden =YES;
home.view2.hidden =NO;
[home release];
[self dismissModalViewControllerAnimated:YES];
}
This is the method that I tried calling from myViewController1 from myViewController2:
Code:
-(void)hideHome:(id)sender {
view2.hidden =NO;
view1.hidden =YES;
}
Any suggestions?