I built a hierarchy of viewControllers and in my storyboard scene I need to move two nibs ahead. The problem is that after I return to controller, it seems to lose the id that is important to retrieve required data from DB. One nib ahead OK, but after two nibs NO.
Also, after returning neither -viewWillAppear
nor -viewDidLoad
get fired. Thank you in advance.
I checked if segue really feeds the right data. The final nib gets right id. So, problem isn't data lost while segue.
CODE:
First nib receives data from main nib. viewWillAppear
fetches data from DB and fills up the labels etc.
Navigation begins here.
if([segue.identifier isEqualToString:@"toDublicates"])
{
DublicatesViewController *controller=(DublicatesViewController*)[segue destinationViewController];
// controller is tableViewController
controller.typeID=self.typeID;
controller.nominalID=self.nominalID;
controller.regionID=self.regionID;
controller.subCountryID=self.subCountryID;
KMObj *obj=[self.arr objectAtIndex:0];
controller.title=[NSString stringWithFormat:@"Dublicates | KM%@",obj.kmRef];
}
Second nib. NSLog reveals that data is OK. Moving to final nib
if([segue.identifier isEqualToString:@"toCreateDublicate"])
{
NewDublicateViewController *controller=(NewDublicateViewController*)[segue destinationViewController];
controller.typeID=self.typeID;
controller.subCountryID=self.subCountryID;
controller.nominalID=self.nominalID;
controller.regionID=self.regionID;
controller.numberOfExistingDublicates=[_arr count];
}
The method that fires in final controller
-(void)back {
[self.navigationController popViewControllerAnimated:YES];
}