Let's play with MapKit.
What's to learn from this app?
-
Measures and tracks your runs using Core Location.
[self.locationMgr startUpdatingLocation]; [self.locationMgr stopUpdatingLocation];
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;
-
Displays real-time data, like the run's average pace, along with an active map.
[NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(eachSecond) userInfo:nil repeats:YES]; [self.timer invalidate];
Step-1: set the map region/bounds so that only the run is shown and not the entire world. (Required) Step-2: set the lines over the map to indidate where the run went. (Required) Step-3: Style it. tell the map view to add all the annotations. (Optional)
-
Maps out a run with a color-coded polyline and custom annotations at each checkpoint (match badge's distance spot).
MultiColorPolylineSegment : MKPolyline BadgeAnnotation : MKPointAnnotation
mapView:rendererForOverlay: mapView:viewForAnnotation:
-
Badges and Awards for personal progress in distance (Badge) and speed (Award). math calculator and algorithm in BadgeController
-
Core Data
NSManagedObjectModel *managedObjectModel; NSPersistentStoreCoordinator *persistentStoreCoordinator; NSManagedObjectContext *managedObjectContext; // like a DB connection