0
我注意到,新的地图应用程序有一个功能,我需要在我正在制作的应用程序中实现。该功能是当用户在某个位置放置一个PIN时,该地址将显示为注释视图的副标题。有谁知道这是怎么做到的吗?MKAnnotation获取地址
我注意到,新的地图应用程序有一个功能,我需要在我正在制作的应用程序中实现。该功能是当用户在某个位置放置一个PIN时,该地址将显示为注释视图的副标题。有谁知道这是怎么做到的吗?MKAnnotation获取地址
你应该在你的自定义注释实现字幕属性,如:
// Geo.h
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
@interface Geo : NSObject <MKAnnotation>
@property (nonatomic, strong) NSString* subtitle;
// Geo.m
#include "Geo.h"
@implementation Geo
- (NSString *)subtitle
{
return _subtitle; // Here you can reverse geocoding to get address from a CLLocationCoordinate2D object
};