點擊地圖事件

點擊地圖事件

點擊地圖觸發事件,於點擊地圖時觸發,點擊地圖觸發事件程式範例說明如下:

- (void)mapView:(TGMapView *)mapView

didTapAtCoordinate:(CLLocationCoordinate2D)coordinate  //點擊地圖時觸發事件

{

NSString * txt = @"Tap : WGS84 = %f,%f , TWD97 = %f,%f , Screen = %f,%f";

PointD *twd97 = [TGTransformation wgs84ToTWD97:coordinate];

CGPoint ScreenPt = [mapView_.projection pointForCoordinate:coordinate];

txt = [NSString stringWithFormat:txt,coordinate.latitude,coordinate.longitude,twd97.X,twd97.Y,ScreenPt.x,ScreenPt.y];

[self setLabelTxt:txt];

NSLog(@"%@",txt);

   

[self addMarker:coordinate];

}

回到上方