我正确地将 MapView 连接到我的代表。此外,用户位置确实显示在地图上,但应该显示在同一位置的 MKCircle 没有这样做。它在某个时候起作用,但不知何故停止了工作。这是我的一些代码。
- (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];
}