Building an Integrated Directory App / Adding a Map
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
Now, we've got a phone button and an e-mail button and we display the title and the location for this object. But what can we do to match these phone and e-mail buttons? Well, we have a clue if you go into the library and look at Buttons because this will give you an idea what is being supported. We already have the phone. We have the e-mail and this folded map is a map button. But it makes sense to put it onto the app and let the app map the location of this library. Now, in order to put that button there, I'm going to move these fields over. I'm just actually reducing their size and I can now drag the map button here and I will handle it very much the way I did the e-mail button or the telephone button, but the difference here is the bindings. In the case of the phone number, it was obvious what the binding was. It's the telephone number. It was bound to this button. But in fact, what I want to do here is I want to bind something to the mapping button and what I'm going to start with is I'm going to come to the address and attempt to bind it here. And remember, when I was binding the address to the field, the Location field, I got a list of ways in which it could be bound. But when I drag it up here to the mapping button, the list is different and I can bind this field, the address field, to the address or the state or any of the others, but these are the only 2 that would make sense. So, I'm going to bind it to the address and then I'm going to bind the state to the State and obviously what's happened is that, what Dashcode wants to do is to put the city into the Address field. So, I've set up the data source incorrectly to handle this binding. It's not a big deal because it's very easy to modify and if you make this mistake, it's easy to go back. What I'm going to do is I'm going to go into the file that I'm using as the data source. And what I'm going to want is that this field address should contain the city and this field address should contain the city name. I no longer need a separate City field so I can take those out and just scan back and forth to see if I've left any stray commas in. I can take the city text field out of the interface because I don't need it and now I'll just have the location and I'll put the state underneath it. So, this should look reasonably good and should provide me with the information that I need. I can come back here to the data source and look at it and you'll see that the dataSource is the old one with the address, the city separate and the state. When I make a change to the underlying dataSource file, I have to reload it with this button. And now you can see I've got the city in the Address field. I can move to the next one and you'll see the City field is gone. So let me come back and the bindings from the data model, the state, oops! I don't want to delete it. Let me come back up here. I want this to be bound as text and this is to be bound as the state and now that it's multiple, I can click here and see that I'm binding it to that field and watch as I move the mouse to the button. The address has multiple cases. It's bound to the Address field and it's bound to the Map button address. I don't need to do anything here because what I did was to remove the City field. So, now I'm ready and I can actually try to run this. The only problem is that this is one of the things that will not run properly in the simulator. So what I will need to do in order to run this is first of all to save it and then as I've shown you before, you can deploy it. I'd click Run-N-Share. I can deploy it here. I can go up to a server or I can use a MobileMe account. I have any number of ways of doing it, but I'd bind it. I want to save. Well, I just did save it so I don't need to do it again. And I can save it to disk and then move the whole thing up and it will work. If you touch the mail and the phone buttons, you will not be able to complete the calls in the simulator because it doesn't have those features. But once you've deployed it on your iPhone, it should work.
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
United States 