Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Places You'll Go!

Jay Thrash
November 30, 2012

The Places You'll Go!

Originally given at CocoaConf Raleigh on November 30, 2012.

Come learn how to integrate iOS 6 maps directly into your apps and find out what's required to get your app listed in the marketplace of Transit apps.

With the release of iOS 6, Apple has redesigned MapKit from the ground up to use an incredible new vector-based graphics engine. Although this new engine allows for a level of interactivity which simply wasn't possible under previous releases of iOS, it's just as easy to embed standard or custom maps within iOS apps. In addition, the release of iOS 6 has created a whole new opportunity for developers to create Routing applications which can provide region-specific transit information which is integrated directly into the Maps.app.

Jay Thrash

November 30, 2012
Tweet

More Decks by Jay Thrash

Other Decks in Programming

Transcript

  1. The Places  You’ll Go! ! What’s New for MapKit

    in iOS 6 CocoaConf Raleigh - Nov 2012 Jay Thrash :: [email protected] :: @jaythrash
  2. ! • Same API • Same Display Modes • Existing

    Annotations & Overlays Supported Existing Apps
  3. New Encapsulates information about a specific point on a map

    MKMapItem Apps use this class to launch Maps app with that data Control Map modes, placemarks, regions
  4. Open in Maps ! CLLocationCoordinate2D latLong; latLong.latitude = 35.88409f; latLong.longitude

    = -78.844218f; ! MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:latLong addressDictionary:@{ (NSString *) kABPersonAddressStreetKey : @"4810 Page Creek Lane", (NSString *) kABPersonAddressCityKey : @"Durham", (NSString *) kABPersonAddressStateKey : @"NC", (NSString *) kABPersonAddressZIPKey : @"27703", (NSString *) kABPersonAddressCountryKey : @"United States"}]; ! MKMapItem *location = [[MKMapItem alloc] initWithPlacemark:placemark]; [location openInMapsWithLaunchOptions:nil]; Basic Placemark
  5. ! CLLocationCoordinate2D latLong; latLong.latitude = 35.88409f; latLong.longitude = -78.844218f; !

    MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:latLong addressDictionary:@{ (NSString *) kABPersonAddressStreetKey : @"4810 Page Creek Lane", (NSString *) kABPersonAddressCityKey : @"Durham", (NSString *) kABPersonAddressStateKey : @"NC", (NSString *) kABPersonAddressZIPKey : @"27703", (NSString *) kABPersonAddressCountryKey: @"United States"}]; ! MKMapItem *location = [[MKMapItem alloc] initWithPlacemark:placemark] ! location.name = @"CocoaConf Raleigh"; location.phoneNumber = @"9199416000"; location.url = [NSURL URLWithString:@"http://www......"]; ! [location openInMapsWithLaunchOptions:nil]; Open in Maps Detailed Placemark
  6. Open in Maps NSArray *upcomingLocations = @[ cocoaConfChicago, cocoaConfDC, cocoaConfDallas,

    cocoaConfSanJose]; ! // Class Method to open multiple MKMapItems [MKMapItem openMapsWithItems:upcomingLocations launchOptions:nil]; Multiple MKMapItems
  7. Open in Maps ... ! MKMapItem *location = [[MKMapItem alloc]

    initWithPlacemark:placemark] location.name = @"CocoaConf Raleigh"; location.phoneNumber = @"9199416000"; location.url = [NSURL URLWithString:@"http://www......"]; ! [location openInMapsWithLaunchOptions:@{ MKLaunchOptionsMapTypeKey: [NSNumber numberWithInteger:MKMapTypeHybrid] }]; With Map Type
  8. Open in Maps ... ! MKCoordinateRegion rgn = MKCoordinateRegionMakeWithDistance(location.placemark.location.coordinate, 150,

    150); ! [location openInMapsWithLaunchOptions:@{ MKLaunchOptionsMapTypeKey:[NSNumber numberWithInteger:MKMapTypeHybrid], MKLaunchOptionsMapCenterKey:[NSValue valueWithMKCoordinate:location.placemark.location.coordinate], MKLaunchOptionsMapSpanKey:[NSValue valueWithMKCoordinateSpan:rgn.span] }]; ! With Region
  9. Open in Maps ... ! NSArray *routeLocations = @[cocoaConfColumbus, cocoaConfPortland];

    ! // Class Method [MKMapItem openMapsWithItems:routeLocations launchOptions: @{ MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving } ]; Custom Directions