How to find coordinates in Apple maps?

0

I need to show several different places on the map, one for each location, I would like to know how I can point to each coordinate through the code?

In case the app is for iOS, using Objective-C.

    
asked by anonymous 20.10.2014 / 03:29

1 answer

2

Using MapKit requires few lines of code. After adding the framework to the project and the map itself on the screen, you can insert a point in a given coordinate like this:

// Alloca um novo MKPointAnnotation que pode ser usado como pin no mapa
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];

// Ajusta para a coornedada desejada
point.coordinate = CLLocationCoordinate2DMake(-21.805149, -49.089977);

// Pode customizar o título e subtitulo
point.title = @"Título";
point.subtitle = @"Subtitulo do pin";

// Adiciona o pin no mapa
[self.mapView addAnnotation:point];
    
20.10.2014 / 05:32