如何在Apple Maps Route上更改注释标题

时间:2013-07-05 20:55:09

标签: ios xcode cocoa-touch maps apple-maps

我使用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];

它打开一切都很好......但是只有一个问题:我不能改变这个注释名称:

unknown location

1 个答案:

答案 0 :(得分:3)

mapItem.name = @"Place name";

MKMapItem Class Reference