First commit
This commit is contained in:
29
Classes/Classes-1.moved-aside/CoreLocationController.h
Executable file
29
Classes/Classes-1.moved-aside/CoreLocationController.h
Executable file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// CoreLocationController.h
|
||||
// CoreLocationDemo
|
||||
//
|
||||
// Created by Nicholas Vellios on 8/15/10.
|
||||
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@protocol CoreLocationControllerDelegate
|
||||
@required
|
||||
|
||||
- (void)locationUpdate:(CLLocation *)location;
|
||||
- (void)locationError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface CoreLocationController : NSObject <CLLocationManagerDelegate> {
|
||||
CLLocationManager *locMgr;
|
||||
id delegate;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) CLLocationManager *locMgr;
|
||||
@property (nonatomic, assign) id delegate;
|
||||
|
||||
@end
|
||||
44
Classes/Classes-1.moved-aside/CoreLocationController.m
Executable file
44
Classes/Classes-1.moved-aside/CoreLocationController.m
Executable file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// CoreLocationController.m
|
||||
// CoreLocationDemo
|
||||
//
|
||||
// Created by Nicholas Vellios on 8/15/10.
|
||||
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CoreLocationController.h"
|
||||
|
||||
|
||||
@implementation CoreLocationController
|
||||
|
||||
@synthesize locMgr, delegate;
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
|
||||
if(self != nil) {
|
||||
self.locMgr = [[[CLLocationManager alloc] init] autorelease];
|
||||
self.locMgr.delegate = self;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
|
||||
if([self.delegate conformsToProtocol:@protocol(CoreLocationControllerDelegate)]) {
|
||||
[self.delegate locationUpdate:newLocation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
|
||||
if([self.delegate conformsToProtocol:@protocol(CoreLocationControllerDelegate)]) {
|
||||
[self.delegate locationError:error];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self.locMgr release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user