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 browser template before and we were going to look at it again now in more depth and as I said at the beginning, it's like peeling an onion. We'll actually look at it several more times, each time from a different perspective and in more depth. So I'm going to start now. I want to use a template only for Mobile Safari. I'll use the browser and the basic template is here and now we have time to look at it a little more carefully than we did at the beginning because we've seen how the various components work. So let me open up this section here in the navigator so that you can see everything that's available and now all of the elements of the browser template have been opened and you can see the key to it is a stackLayout object, which we've used before and you can see that the stackLayout has two views within it; the list level and the detailLevel. These come bundled with the browser template. And if I look at the stackLayout, you'll see that here I have those sub-views and as I pointed out previously, in the case of the browser template, I don't have the ability to change the sub-view transitions. It's already been hard wired. If I'm using a stackLayout element all on its own, yes, I can change it but this is no big deal and it actually makes the browser template more functional more quickly. So I've got those attributes there and as you can see over here, if I look at the list row template, remember I have this little three-dimensional cube here and if I look at bindings you will see that I have an on click behavior attached to the list row template. What that means is the behavior icon here is put onto the list row template. I can see it here and I can see what it is. I can click here and look at the source code. We're still not writing code but we're getting closer and closer and we're not going to be looking at it and here is the item clicked handler that the browser template has placed on the list row template and the item click handler, which we'll go into more in depth later, but it has a basic structure that you often see with these handlers. I'll close this one. The first thing it does is it gets an element by ID and what it's doing is it's getting this list element. Then it's going to get another element in the document by ID. It's getting the browser element and then it's going to from the list here, it's going to get the selected objects and if it's found them, what it's going to do is send a message to the browser object, which it found here and here is the browser object and the message is go forward to detailLevel, which is right here and selected objects value for key. That's something we'll come back to but this is the selected objects that it found from the list view. Now, don't worry about this because we'll go through it again in yet more detail but this is the basic structure of almost every handler that involves a click. First of all it comes in and it gets references to other objects in the template, usually be using get element by ID and then it sends a message to one or more of those objects. It may, as in this case, get call a function selected objects off of list. Here it's calling go forward. This is all basic JavaScript code and it's very object oriented. What you're doing is you're taking an object because everything here is in fact an object and you can send a message to it or call a function on it. Whether you talk about sending a message or calling a function is, there is a technical difference to it but it's more a matter of what you're comfortable with and what side of object-oriented programming you first became involved with. So this is what I've got in the template now looking at it from the structural point of view and all of the elements that are in the template. I can now go ahead and test it and see what I get out of the box and that's what we'll do next.
| 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 |