I have this code :
-(IBAction)OkButtonPressed:(id)sender{
NSLog(@"BTN OK");
RecherchePartenaireTableView *recherchePartenaireTableView=[[RecherchePartenaireTableView alloc]init];
recherchePartenaireTableView.mytext=textFieldCode.text;
[self.navigationController popViewControllerAnimated:YES];
}
and after I press ok I see in console the message "BTN OK" and nothing else. In class RecherchePartenaireTableView I have the methods viewWillAppear, viewDidload... and a NSLog message for each method. What method is called after [self.navigationController popViewControllerAnimated:YES];
?
If you are trying to set a property of class RecherchePartenaireTableView
, which is on the navigation stack already then you are doing it wrong by creating a new instance of it.
You should be getting back the instance from navigationController stack.
Change
RecherchePartenaireTableView *recherchePartenaireTableView=[[RecherchePartenaireTableView alloc]init];
recherchePartenaireTableView.mytext=textFieldCode.text;
To
NSArray *viewControllers = [self.navigationController viewControllers];
RecherchePartenaireTableView *recherchePartenaireTableViewVC = (RecherchePartenaireTableView *)[viewControllers objectAtIndex:viewControllers.count - 2];
recherchePartenaireTableViewVC.mytext=textFieldCode.text;
viewDidAppear
method will be called on the class you pushed the view from.