Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
We've looked at the basics here, the first part of the Load function. Now comes another call to a function, setupParts and this is a standard part of initiating the program and you can see I can jump around to it and find. Here is the function itself and it's in a file called Utilities, the JavaScript Utility. I was in Main before, which is indeed the main file for your app and from there, everything else gets called. Behind the scenes, there's a Utilities file that is brought into the templates by Dashcode and this Ñ as we go down into deeper and deeper layers, you less frequently modify these files. But that's what's going on; the parts are being set up here. So let me go back to Main. We'll skip over setupParts now and now we come to another section here, which calls the initDB function which is where we initialize the database for this running of the app and that's what we want. And you can see down here that if we return the database from initDB and if we don't have it, then we set the property value of element to the original settings message, which we set up here which was set from element.value and don't worry about this, it'll become a little clearer as we go into initDB. The point is that the Load function called when the body of index.html is loaded. Load function is called. It does a little bit of housekeeping up here. It sets up parts and then it initializes the database if the app is going to be using the internal database rather than data sources or rather than no data store at all. So, this is where we have to worry about it. So let's take a look at initDB and the same method come up here, initDB and I can see the function is here and it's in Utility support and now we do have a bunch of code to look at. I can step you through it fairly quickly because there really isn't much here but it gives you a flavor for what we're doing when we work with SQLite. And we're going to have to look at some transactions and don't worry about it because at this point, all you need to do is to see the structure of it and understand a little bit about what it does and then if you need to modify it in the future, it's just going to be a matter of making a change to a small part of it. The structure of the initDB function is not going to change no matter how you modify the app. So, let's go and take a look in initDB.
| Course: | Developing iPhone Web Apps |
| Author: | Jesse Feiler |
| SKU: | 34075 |
| ISBN: | 1-935320-89-0 |
| Release Date: | 2009-12-31 |
| Duration: | 8 hrs / 103 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |