Showing posts with label MapKit. Show all posts
Showing posts with label MapKit. Show all posts

Wednesday, 16 March 2016

How to launch Apple Maps from iOS app


applemaps.png

Hi Readers!
Below is the code to launch the Apple Maps application and display the directions between 2 points on Map.
Example 1: Display directions
  1. MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(42.313432,-71.057157) addressDictionary:nil];
  2.   MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
  3.   item.name = @"Boston";
  4.  
  5.   MKPlacemark *placemark1 = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(35.843871,-78.645056) addressDictionary:nil];
  6.   MKMapItem *item1 = [[MKMapItem alloc] initWithPlacemark:placemark1];
  7.   item1.name = @"Raleigh";