Kimberly
Kimberly

Reputation: 127

Plotting CLLocation/CLLocationCoordinate2D on a MKMapView

I am obtaining the users location via Parse and the object is returned as a PFGeoPoint. I have converted it to a CLLocation / CLLocationCoordinate2D by doing so:

CLLocation *loc = [[CLLocation alloc] initWithLatitude:self.geoPoint.latitude longitude:self.geoPoint.longitude];
    CLLocationCoordinate2D coordinate = [loc coordinate];

Question is to add an annotation on a mapView it appears I need a MKPointAnnotation. How would I go about converting what I have to be able to add it to my mapView?

Upvotes: 0

Views: 693

Answers (1)

Palle
Palle

Reputation: 12109

You can create a MKPointAnnotation for a specific location this way:

MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = coordinate;

This annotation can then be added to the map view.

[mapView addAnnotation:annotation];

Upvotes: 3

Related Questions