0
我在這裏失去了我的想法。爲什麼這不起作用? update_map方法被調用,但viewForOverlay不會。iOS MKMapView viewForOverlay不叫
- (void)viewDidLoad {
[super viewDidLoad];
if(mapView2 != nil)
{
[self update_map];
}
- (void)update_map
{
CLLocationDistance fenceDistance = 100000;
MKCircle *circle = [MKCircle circleWithCenterCoordinate:newCoord radius:fenceDistance];
[mapView2 addOverlay:circle];
}
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
NSLog(@"circle overlay");
MKCircleView *circleView = [[MKCircleView alloc initWithOverlay:overlay];
[circleView setFillColor:[UIColor blueColor]];
[circleView setAlpha:0.1f];
return circleView;
}
地圖視圖發送消息向其代表介紹地圖數據的加載和正在顯示的地圖部分的變化。我想知道,如果你已經設置了代表? – ldindu 2015-02-08 12:37:28
確保mapView不是零,代表已設置 – 2015-02-08 12:55:18