I properly hooked up the MapView to my delegate. Also, the user location does show up on the map, but the MKCircle that's supposed to show up at this same location doesn't do so. It worked at some point, but somehow stopped working. Here is some of my code.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
userLocation = newLocation;
MKCircle *circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:500];
circle.title = @"Nearby sites";
[worldView addOverlay:circle];
}
With annotations, the viewForAnnotation
delegate method does not need to be implemented and the map view will draw the default red pin.
But for overlays, you must implement the viewForOverlay
delegate method.
The map view does not supply a default overlay view.