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.
What I'm going to do is to go back to the basic regionData file and what I'm going to do is to add to it another field. I can actually close that and work right in here. I want to add another field called View and I'm going to make it empty in most cases. Let me copy that and come down here and add it here and for the intermountainRegion, I'm going to want to go to the intermountain Region View and for the northeastRegion, I want to go to the northeastRegion View and for the others, they will be undefined and they won't work for the moment, so I've broken them except for intermountainRegion and Northeast region and I've done that deliberately and I can get rid of this comma here at the end which doesn't belong there so I now have a revised file here. I can save that and come into the dataSource. I need to reload it and you can see I've got the views here and as I step through, I can see, in the case of intermountain, I have a value here. It is not connected to anything in the view. I've got it there but I'm ready to use it as I get into the code where I'm going to select which view I go to from the region list level. What I want to do is to go in and use this new view field in the dataSource as I am dispatching to the appropriate click in the region list so I'll come here to list row template and come up here and look in the Inspector at the onclick handler and this is the onclick handler for any region that's clicked and it's going to send me always at this point to the northeastRegion. I want to now go to whatever region I have specified in that view parameter so what I'm going to do here is what I commonly do. I'm going to Copy and Paste that line of code and adjust the spacing. I'm going to turn this into a comment in case I need to come back to it and now what I want to do is to pick up that view parameter in the dataSource and set it into a local variable and I'm going to say the view is and I've already done it for the name when I'm coming down here in this code. I'm picking up the name to be used at the top so I can take this code, that gets me the name out of the dataSource and what I want here is not the name, I want that view field. So that's how I get the value from the view. It's the value for the key. That's the field in the dataSource for the selected object in that list and now what I want to do is change this and I want to get an element by the ID. I no longer want to hard-code the northeastRegion. I want to get the element by the ID that is stored in the view variable that I've just set and this is the logic that I want to use to let me go to a specific view based on what has been clicked. Now, I'll save this and then I'll run it in the Simulator.
| 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 |