-
Notifications
You must be signed in to change notification settings - Fork 0
/
Venue.m
64 lines (54 loc) · 1.18 KB
/
Venue.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Venue.m
// LocationSample
//
// Created by Daniel Barden on 9/20/11.
// Copyright (c) 2011 None. All rights reserved.
//
#import "Venue.h"
@implementation Venue
@synthesize name = _name;
@synthesize photos = _photos;
@synthesize location = _location;
@synthesize description = _description;
#pragma mark - Initializers
- (id)init
{
if ((self =[super init])) {
}
return self;
}
- (id)initWithName:(NSString *)name
{
if ((self = [self init])) {
self.name = name;
}
return self;
}
- (id)initWithName:(NSString *)name withLatitude:(double)latitude withLongitude:(double)longitude
{
if ((self = [super init])) {
self.name = name;
_location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
}
return self;
}
#pragma mark - Location Methods
- (void)updateDistance:(CLLocation *)coordinate {
double distance = [_location distanceFromLocation:coordinate];
_distance = distance;
NSLog(@"distance %g", _distance);
}
- (NSString *)distance
{
if (_distance == 0)
return nil;
return [NSString stringWithFormat:@"%g metros", _distance];
}
- (void)dealloc
{
[_location release];
[_name release];
[super dealloc];
}
@end