Last active
August 29, 2015 14:01
-
-
Save odemolliens/9babf9a3a9f80ba7382c to your computer and use it in GitHub Desktop.
MKAnnotation Override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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