tags:

views:

42

answers:

1

I am trying to do something very basic, but no luck so far. Here is what I need to get done.

Parse an XML file.

<cars>
 <car>
   <company>BMW</company>
   <model>ABC</model>
 </car>

 <car>
   ...
   ...
 </car>
</cars>

I have created 2 classes (subClass of NSObject) one is Car and nother is junkyard. Car class holds all the data of a car. And junkyard holds all the car objects inside a NSMutableArray cars.

Now I am able to parse everything fine and put the data in an array. But my problem is I want to access this data from a view controller to display in a nib. I dont know how can I pass the same cars array from my appdelegate class to the viewcontroller class. Please help.

BTW I am not using a UINavigationController.

A: 

The two objects need references to each other (or at least one needs a reference to the other). How you accomplish this is up to you, and depends on the situation. Getting a reference to the app delegate is generally pretty easy, since you can just ask the application for its delegate.

Chuck