Skip to content

Instantly share code, notes, and snippets.

@jcalonso
Created October 10, 2012 16:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcalonso/3866874 to your computer and use it in GitHub Desktop.
Save jcalonso/3866874 to your computer and use it in GitHub Desktop.
Custom MKAnnotation
#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
@interface MapAnnotation : NSObject <MKAnnotation> {
@public
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
NSDictionary *placeData;
NSObject *object;
BOOL isPerson;
}
@property BOOL isPerson;
@property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, copy) NSDictionary *placeData;
@property (nonatomic, strong) NSObject *object;
- (id) initWithTitle:(NSString *)theTitle
subtitle:(NSString *)theSubtitle
coordinate:(CLLocationCoordinate2D)theCoordinate
isPerson:(BOOL)ifItsPerson
placeData: (NSDictionary *) thePlaceData;
@end
------
#import "MapAnnotation.h"
@implementation MapAnnotation
@synthesize coordinate, title, subtitle, object,placeData,isPerson;
- (id) initWithTitle:(NSString *)theTitle
subtitle:(NSString *)theSubtitle
coordinate:(CLLocationCoordinate2D)theCoordinate
isPerson:(BOOL)ifItsPerson
placeData: (NSDictionary *) thePlaceData{
if (self = [super init]) {
self.title = theTitle;
self.subtitle = theSubtitle;
self.coordinate = theCoordinate;
self.placeData = thePlaceData;
self.isPerson = ifItsPerson;
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment