However I would now like to go a bit further and add a bit more functionality to the app by allowing the user to plot points on the map themselves.
I somehow believe using CoreLocation will accomplish this by receiving and saving coordinates of where the user selects on the map.
Am I right in saying this? and any ideas on how I would implement this? Links or tutorials would be helpful too, and also any personal experience/ideas in the matter would be great.
I have created an app that implements coreLocation before this app, compiled/ran perfectly.. just didnt update user location and latitude/longitude. the code is shown below for that app:
This is only in the AppDelegate.m which is what does all the work basically.
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize window;
@synthesize viewController;
@synthesize locationManager;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
self.locationManager = [[CLLocationManager alloc]init];
if ([CLLocationManager locationServicesEnabled]) {
self.locationManager.delegate = self;
self.locationManager.distanceFilter = 100;
[self.locationManager startUpdatingLocation];
}
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}
#pragma mark CLLocationManagerDelegate Methods
-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
MKCoordinateSpan span;
span.latitudeDelta = 0.2;
span.longitudeDelta = 0.2;
MKCoordinateRegion region;
region.span = span;
region.center = newLocation.coordinate;
[viewController.mapView setRegion:region animated:YES];
viewController.mapView.showsUserLocation = YES;
viewController.latitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
viewController.latitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];
}
@end

New Topic/Question
Reply


MultiQuote




|