Reputation: 778
Hi friends i tried to parse the xml and show in table view .
but without use of appDelegate object how can we .
i have seen in many site that was started from application beginning .
but i want to know if i need to parse and show in different view controller which is not root
view controller and also should not use the application delegate?
please any genius
Upvotes: 1
Views: 74
Reputation: 32094
So it sounds like you have a data model saved as XML somewhere, and when your application loads, you want to parse it and keep the model in memory.
In my experience, the application delegate is actually the place to keep stuff like this. Since it's something that both the application delegate, and the random UIViewController
need to know about, the app delegate is a good place to keep it.
Once you've loaded your model using the NSXMLParser
or your preferred loader, you can (in your UIViewController
) use something like:
MyModel *model = ((MyAppDelegate *)[[UIApplication sharedApplication] delegate]).myModel;
Upvotes: 1