I customized the action of back button. I want to send to parent view a BOOL if back is pressed, but the bool value is always null.
my parent .h
[...skip...]
BOOL myBool;
[...skip....]
my parent .m
#import "theChild.h"
....
- (void)viewWillAppear:(BOOL)animated {
NSLog(@"myBool is %d", (int)myBool);
}
-(IBAction)callTheChild:(id)sender {
theChild *theChildVC = [[theChild alloc] initWithNibName:@"theChild" bundle:nil];
// set something
[self.navigationController pushViewController:theChildVC animated:YES];
[theChildVC release];
}
in my theChild .m
#import "theParent.h"
....
....
-(void)backAction:(id)sender {
theParent *theParentVC = [[addSite alloc] init];
// set parent BOOL
theParentVC.myBool = YES;
[addVC release];
// dismiss child view
[self.navigationController popViewControllerAnimated:YES];
}
when the parent appear, myBool is null.
if I change
[self.navigationController popViewControllerAnimated:YES];
to
[self.navigationController pushViewController:theParentVC animated:YES];
all works fine but is not what I want for several reasons.
Any help is appreciated.
Thanks, Max