MKOverlayView

为地图加载覆盖物

  • 现在didLoadView中加入
MKCircle* circle = [MKCircle circleWithCenterCoordinate:newloc radius:5000]; 
[mapView addOverlay:circle];
  • 第二步 用MapView的代理方法
(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay{ 
  if ([overlay isKindOfClass:[MKCircle class]]) {  
       MKCircleView* circleView = [[[MKCircleView alloc]   
       initWithOverlay:overlay] autorelease]; 
       circleView.fillColor = [[UIColor cyanColor] colorWithAlphaComponent:0.2]; 
       circleView.strokeColor = [[UIColor blueColor] colorWithAlphaComponent:0.7]; 
       circleView.lineWidth = 3.0; 
       return circleView; 
    } 
    return nil; 
}

你可能感兴趣的:(MKOverlayView)