Chapter 9. Working with location and maps

 

This chapter covers

  • Using maps in your views
  • Getting the current location
  • Showing pins on a map

The iPhone has so many features that many things that used to be separate gadgets can be apps. For most of us, the GPS on the phone is sufficient for our location and direction needs, and we don’t need a dedicated GPS device. The next application you’ll write, Parkinator, uses this feature to solve an important mobile computing problem: remembering where you parked.

Designing a map application

Let’s make the UI for this app just a front and back screen. On the front, you’ll see your location and the last place you parked. On the back, you’ll take a picture of your car, and when you’re finished, the app will flip back and put a pin at your spot.

Sketching Parkinator

Let’s make a quick sketch.

Figure 9.1. Sketch of the front and back screens

See the little i in a circle at the bottom? That’s how you get to the flip side of the app. You haven’t used this kind of navigation before, but lots of apps use it, including the built-in Weather app.

Looking at how it works

This application’s behavior is simple. Because you just want to learn about location, maps, and pins, we’ll make sure the rest of the app uses things you’ve seen before.

Here’s how you want it to work.

Figure 9.2. Sketch of the app’s behavior

Creating an app with a map

 

Flipping the view to take a picture

 
 

Showing the parking spot on the map

 
 
 

Making the data in Parkinator useful to others

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage