I have loaded an array (recordArray) in RootViewController class which I need to pass to the DetailViewController class so that I can access any variable within it. I can pass a single value successfully, but I cannot get how to pass the whole array across.
I have created a second NSMutableArray recordArray in DetailsViewController.h, added the @property statement (with retain), and synthesized in DetailsViewController.m. I then added the following line in DetailsViewController.m
recordArray = [[NSMutableArray alloc] initWithArray:self.recordArray];
but that just gives me an empty array in the detail view.
I have read through some of the posts on this, but have not found anything which I understand sufficiently to be able to implement. I expect I’m going about this all wrong….
Thanks in advance for your help guys.
Please refer to this code:
iPhone SDK: How do I pass an array of values from a ViewController onto other ViewController?
There you can refer to Satya‘s answer.
Let me know if you need more help
EDIT:
Let us assume that there is an
NSArraycalledsecondArraydeclared inSecondViewControllerDefine a method in SecondViewController which says:
Hope this helps.