Skip to content

Instantly share code, notes, and snippets.

@odemolliens
Last active August 29, 2015 14:01
Show Gist options
  • Save odemolliens/9babf9a3a9f80ba7382c to your computer and use it in GitHub Desktop.
Save odemolliens/9babf9a3a9f80ba7382c to your computer and use it in GitHub Desktop.
MKAnnotation Override
//
// ODMapAnnotation.h
// iVelo
//
// Created by Olivier Demolliens on 24/06/13.
// Copyright (c) 2013 Olivier Demolliens. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface ODAnnotation : NSObject <MKAnnotation> {
CLLocationDegrees _latitude;
CLLocationDegrees _longitude;
NSString *_title;
int pos;
}
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) int pos;
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
- (id)initWithLatitude:(CLLocationDegrees)latitude
andLongitude:(CLLocationDegrees)longitude;
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate;
@end
//
// ODMapAnnotation.m
// iVelo
//
// Created by Olivier Demolliens on 24/06/13.
// Copyright (c) 2013 Olivier Demolliens. All rights reserved.
//
#import "ODAnnotation.h"
@interface ODAnnotation()
@property (nonatomic) CLLocationDegrees latitude;
@property (nonatomic) CLLocationDegrees longitude;
@end
@implementation ODAnnotation
@synthesize latitude = _latitude;
@synthesize longitude = _longitude;
@synthesize title = _title;
@synthesize pos;
@synthesize coordinate;
- (id)initWithLatitude:(CLLocationDegrees)latitude
andLongitude:(CLLocationDegrees)longitude {
if (self = [super init]) {
self.latitude = latitude;
self.longitude = longitude;
coordinate.latitude = self.latitude;
coordinate.longitude = self.longitude;
}
return self;
}
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate {
self.latitude = newCoordinate.latitude;
self.longitude = newCoordinate.longitude;
}
- (void)dealloc
{
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment