Domanda

I've created a route from A to B with MKMapItem, but I can't change the title of the annotation on the map. My code:

CLLocation *locationRestaurante = [[CLLocation alloc] initWithLatitude:[[[listaRestaurante objectAtIndex:0] objectForKey:@"latitude"] floatValue] longitude:[[[listaRestaurante objectAtIndex:0] objectForKey:@"longitude"] floatValue]];

        MKPlacemark *place = [[MKPlacemark alloc] initWithCoordinate:locationRestaurante.coordinate addressDictionary:nil];

        MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];

        NSDictionary *options = @{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving};

        [mapItem openInMapsWithLaunchOptions:options];

it opens everything just fine... But there's only one problem: The I can't change this annotation name:

unknown location

È stato utile?

Soluzione

mapItem.name = @"Place name";

MKMapItem Class Reference

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top