Home
Username:
Password:
Developing iPhone Web Apps Tutorials

Parts/Behaviors & Stack Layouts / Adding More Views & Buttons




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.


Learn More

Subtitles of the Movie

What we've seen here is how I can use the stackLayout and place views within it. I can add additional views, I could add a triangle view if I wanted to and as I add more views I can also add buttons to them so that I can come up for example here and bring a button over here and I want in the Metrics to make sure it's absolute positioning so that I can put it wherever I want and I can put a triangle shape here and switch back and forth from one view to another. But you'll see this is one of the pitfalls of this type of navigation which is that if I need to switch between a triangle, circle and a square view, then in any given view I'm going to need two other buttons. In the square view I'm going to need a circle view button and a triangle view button. In the circle I'm going to need a square view and a triangle view and in the triangle view I'm going to need the circle and the square button. And pretty soon you're going to see that there's not going to be enough space for all the buttons and that's one of the reasons why you use things like browsers so that the navigation comes outside of the stackLayout so that you can navigate through layers and the organization is there but you do not need to have a whole variety of buttons. In a browser it's very simple because you've got this hierarchical structure so you can either go forward or back, down one level or up one level. So you are not jumping around the way we've done here but you've created a hierarchy and relationships that let you navigate logically through the data. So this is the basic structure that you need to worry about when you're using the stackLayout and multiple views. It's very simple and you've seen how you can use Metrics here to change the positioning using absolute positioning here and you've also seen how you can use behavior to create new handlers and the code appears down here. One of the things that I'll point out to you is that the generation of code that happens and you can see here are the functions that I've used, you may have to do a little bit of cleaning up, taking out extra lines, fixing indents, taking out comments that no longer apply but one of the things you also will notice is that the sequence that I followed in creating, automatically creating these handlers, is very important so that for example, I'm going to create a handler for this button. I'm going to go into the inspector and I'm going to create a test handler for on click. And there it is. It popped up right away but if I were to come in here, let's take this out, I come in here and create test handler and I'll click out of it and now I've got the arrow that takes me into the source code. Note that the creation of the shell of the handler happens when I create the name and press return when I am already in there and I haven't done it now so it won't appear. But anything that happens other than that is going to prevent the shell of the handler from being created and the reason is quite simple. It's that Dashcode sees that you are editing this file and it's not going to undo what you've done, whether it's deliberate or not. So the trick here is find the event you want to handle, type in the name of the handler and press return right away rather than clicking out of it so that the shell of the function is going to be created and that's the only trick to using this automatic generation of code and then once it's in there you can put in code snippets from the library and as you've seen, all you're doing is changing the names of views in response to the comments that are in the library. So this gives you an overview of tying it together using the stackLayout to handle multiple views and creating handlers for behaviors for the objects that you're working with. And now it's time to mov on and to take a look at the structure of browsers and how that simplifies navigation and in order to do that we're going to have to take another little sidetrack and look at data because a browser without data is worthless.

Tutorial Information

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: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available