viewControllerB の 2 つの viewController があり、navigationBar の戻るボタンから viewControllerA に戻るときに、ブール値を渡してほしい。プロトコルを使用しましたが、機能しません。
ViewControllerB.h 内
@protocol detailProgrammFiereDelegate <NSObject>
@required
-(void) addItemViewController: (ViewControllerB *)programmFiere withBool:(BOOL)booleanFiere;
@end
.....
@property (nonatomic, weak)id <detailProgrammFiereDelegate>delegate;
.......
ViewControllerB.m で
- (void)viewDidLoad
{
......
BOOL booleanFiere =YES;
[self.delegate addItemViewController:self withBool:booleanFiere];
}
ViewControllerA.h 内
@interface ViewControllerA: UIViewController <detailProgrammFiereDelegate>
ViewControllerA.m で
-(void)addItemViewController:(DetailProgrammFiere *)programmFiere withBool:(BOOL)booleanFiere{
//after pressing back button of viewControllerB not enter into this method. Why?
if (booleanFiere){ //is already true before opening the ViewControllerB. Why?
[self viewDidLoad];
}
}
........
-(void)getInformationsFiere:(id)sender{ //method that open ViewControllerB
ViewControllerB * detailFiere =[[ViewControllerB alloc]initWithNibName:@"ViewControllerB~iPhone" bundle:nil];
detailFiere.delegate =self;
[self.navigationController pushViewController:detailFiere animated:YES];
}
ブール値は、ViewControllerB を開く前に既に true であり、これは発生しないはずです。