Я настроил действие кнопки назад.Я хочу отправить родительскому представлению BOOL, если нажата кнопка назад, но значение bool всегда равно нулю.
мой родитель .h
[...skip...]
BOOL myBool;
[...skip....]
мой родитель .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];
}
в моем 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];
}
, когда появляется родитель, myBool будет нулевым.
, если я изменю
[self.navigationController popViewControllerAnimated:YES];
на
[self.navigationController pushViewController:theParentVC animated:YES];
все работает отлично, но это не то, что я хочу по нескольким причинам.
Любая помощь приветствуется.
Спасибо, Макс