I'm trying to build an app that uses data from a sqlite database.
The navigation is done by multiple tabs like the iPod app, each tab connects to a table view that presents to the user a especific type of data retrieved from the database (for ex. imagine the database is a restaurant list, each tab presents a unique type of cuisine: french, chinese, etc...)
However the tutorials that i find around the net only represent/teach how to make an app that works with a database in a single view, without any tab controller...
I don't know how i can adapt the tutorials i find to my needs, or even the example SQlite books from the great Apple. . .
I ran into the same problem, having a tab view and trying to connect a Sqlite database to the different views.
Is there anybody out there with an idea or resource?
I really would appreciate, thank you!
Open the database in the "applicationDidFinishLoading"-method within the appDelegate. Once it's open you can access it from within the different viewcontrollers via
Open the database in the "applicationDidFinishLoading"-method within the appDelegate. Once it's open you can access it from within the different viewcontrollers via
returns a pointer ( *appDelegate ) to your appDelegate that you can then use to retrieve / interact with variables instantiated in the app Delegate class.
- > if you have a variable myDatabase (in appDelegate) and a method (in app Delegate) getlatestvalueofcolumnDay - you could access this from a view controller calling this method on appDelegate.myDatabase.
I have thought of using this method (ie retrieving data in appDelegate) as i imagine it is a much better way to implement a multiview / single data source rather than have each individual view retrieve it's own relevant data. Any thoughts about this?