3

我已经使用 MKMapItem 创建了从 A 到 B 的路线,但我无法更改地图上注释的标题。我的代码:

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];

它打开一切都很好......但只有一个问题:我无法更改此注释名称:

位置不明

4

1 回答 1

2
mapItem.name = @"Place name";

MKMapItem 类参考

于 2013-07-05T20:57:00.573 回答