iphone - 当前位置的自定义标注

标签 iphone mkmapview mkannotation

我想在当前位置的标注中显示 2 行标签。 MKUserLocation 而不是 MKAnnotation 有人可以帮忙吗?

我确信可以使用自定义标注。但不确定如何为 MKUserLocation 创建它。

最佳答案

viewForAnnotation 方法中,您可以尝试以下操作:

- (MKAnnotationView *)map:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>) annotation{
    if(self._mapView.userLocation==annotation){
       self._mapView.userLocation.title=@"some text";
       self._mapView.userLocation.subtitle=@"some text";
       return nil;
    }
}

希望这有帮助。

关于iphone - 当前位置的自定义标注,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8179827/

相关文章:

IOS - 点击 TabBarItem,检查变量以显示相应的 ViewController

iphone - 重构此代码以符合ARC

iphone - 错误 : The bundle uses a bundle name or display name associated with an Apple app

ios - mkmapview MKUserLocation 注释 View

ios - 更新时自定义注释不会在 map View 上更新

iphone - 声音类中的委托(delegate)如何导致 Controller 类中按钮图像的更改?

ios - iOS 7 中的 MKMapView

ios - 在 UITableView 上出队和重新排队时,MKMapView 不断缩小

iphone - 在缩放之后/期间更新 AnnotationView

ios - 获取 MapView.annotations 数组中 MKAnnotation 的索引