I want to add a disclosure button to a MKAnnotation
to segue to another view.
The button should look like this one:
Here's my .h and .m files.
.h file
//
// POI.h
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface POI : NSObject <MKAnnotation> {
NSString *title;
NSString *subtitle;
CLLocationCoordinate2D coordinate;
}
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
- (id)initWithCoordinate:(CLLocationCoordinate2D)_coordinate title:(NSString *)_titolo andSubTitle:(NSString *)_sottotitolo;
@end
.m file
//
// POI.m
#import "POI.h"
@implementation POI
@synthesize title, subtitle, coordinate;
-(id)initWithCoordinate:(CLLocationCoordinate2D)_coordinate title:(NSString *)_titolo andSubTitle:(NSString *)_sottotitolo {
[self setTitle:_titolo];
[self setSubtitle:_sottotitolo];
[self setCoordinate:_coordinate];
return self;
}
@end
in my ViewController i call this using:
pinLocation.latitude = 4.8874;
pinLocation.longitude = 1.400;
POI *poi = [[POI alloc] initWithCoordinate:pinLocation title:@"foo" andSubTitle:@"bar"];
[_mapView addAnnotation:poi];