I noticed that the new map app has a feature that I need to implement in an app I am making. The feature is when the user drops a pin on a location, the address is shown as the subtitle of the annotation view. Does anyone know how to do that?
You should implement subtitle property in your custom annotation like:
// 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
};