ios - 如何更改 Apple Maps Route 上的注释标题

标签 ios xcode cocoa-touch maps apple-maps

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

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

最佳答案

mapItem.name = @"Place name";

MKMapItem Class Reference

关于ios - 如何更改 Apple Maps Route 上的注释标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17496718/

相关文章:

xcode - 是否可以删除 macOS Xcode CoreSimulator devices 文件夹?

iphone - 丑陋的 heightForRowAtIndexPath 和 cellForRowAtIndexPath

ios - NSURLSession 与后台获取

objective-c - 帮助理解返回单例的类方法

ios - 为什么 iOS 在尝试以相反顺序显示排序结果时会崩溃?

ios - 如何通过 NSDate 对 NSMutableDictionary 中的 "key"和 "value"进行排序?

ios - local dispatch_once value unsafe (transient memory) 触发警告

ios - SwiftUI 通用拉动刷新 View

ios - 缩放后如何将 View 位置重置为原点

ios - 如何在 Cordova 中进行临时构建(带有分发证书/配置文件的 iOS 平台)?