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.
As you saw, I now have all the regions there and I can click on an individual region and come down here to the Park Level where I have a list of all of the parks. But I want to constrain that so it's only the parks for a specific region. And the first way that I'm going to do that is to create a separate view for each region, each one of which will have a dataSource for the parks in that region. I will then come back. I'll implement that and come back and change it a little bit so that it is more generalized so that at the regionList level, I can determine which view I'm going to go to. But for now, what I'm going to do is come here to the Park Level and this has all of the parks in the country. I'm going to duplicate it and see here I have parkLevel1. I'm going to rename this right away. I'm going to call this northeastRegion and this will have a dataSource that only contains the parks in the northeastRegion. So let's see what I have to do. I've got the northeastRegion display over here and as I did before, I can come back and change these items. But I what I want to do now, first of all, is to, for testing, I will change this, the parkItemClicked Function. I'm going to change this to go to the northeastRegion. I'm hard-coding it because we want to make sure it works and then once it works, we'll come back and generalize this. So that's the beginning of it. And now what I'm going to need to do is to look at the files, move this up a bit and I have the sample data which is the data for all the parks in the sample template. I'm going to duplicate this. I've got it up here and I'm going to come down here and for sampledata1, which is what I just created, I'm going to rename it and I'm going to call it northeast. As I mentioned before, renaming things as soon as you handle them makes life much, much easier. So, I've done that. Let me come down here. I will save everything and I want to go into Northeast data, here we have this. The title will be northeast. I'm not using this at the moment but it will be used at some point. And what I want to do is to delete everything that is not in the Northeast and the two in the Northeast are Acadia and Shenandoah. So I'll delete those. Yellowstone and Yosemite are definitely not in the Northeast, get rid of that trailing comma and the square bracket. So that should give me the correct list of parks for the Northeast. That's a start. Now what I want to do down here is to, for the northeastRegion, let me look at the status of my data sources. I need to create a new data source and I'm going to call this northeastDataSource and I come back to the files and its northeastdata.js. So the northeastDataSource is and the general format is the same as it was for the other dataSource. I press return and, lo and behold, I have picked up the data. If I hadn't picked it up, I could reload it from here. But I've got two items, Acadia and Shenandoah. So I've got the dataSource there, everything should be OK. Now I'll come back and look at my data sources and I'm here. I'm just double checking that I'm in the Northeast Region. Let me get rid of this and what I want to do is to associate Shenandoah, the name of the park, with the item in the list. So I'll drag that up here as text and notice that not only do I have the name associated with that list item, I have the list. The data Array has been filled in automatically, so I've got that and it's time to look and see what happens if I try to run it. Let's see what happens when we run the simulator. It's loading. Now I have the list of regions and if I click on any one, I should go to the parks in the Northeast. So I could click here but I'll click on any one but it doesn't matter because that's where everything is hard-coded and I'm going to Acadia and Shenandoah. So I basically have that and as long as I can manage the question of which new view I go to, I'm getting very close to having this thing working.
| 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 |