-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocationState.m
43 lines (35 loc) · 952 Bytes
/
LocationState.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
//
// LocationState.m
// AvocadoTest1
//
// Created by Jake on 12-02-23.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "LocationState.h"
@implementation LocationState
@synthesize selectedLocation;
@synthesize locations;
-(id)initWithLocations:(NSArray *)someLocations
{
self = [super init];
if(self)
{
locations = someLocations;
if([someLocations count] > 0 )
selectedLocation = [someLocations lastObject];
else
CLLog(LOG_LEVEL_WARNING, @"A location state object was initialized without any locations");
}
return self;
}
-(void)setLocations:(NSArray *)someLocations
{
if (selectedLocation)
{
if ([locations indexOfObject:selectedLocation] < [someLocations count]) {
selectedLocation = [someLocations objectAtIndex:[locations indexOfObject:selectedLocation]];
}
}
locations = someLocations;
}
@end