2012-08-17 75 views
0

我有這樣的代碼..mkmap變焦 - Xcode的

-(IBAction)getlocation { 
mapview.showsUserLocation = YES; 
[mapview setCenterCoordinate:mapview.userLocation.coordinate animated:YES]; 

而且我有固定座標的銷..我想是被按下用戶位置的按鈕時,我想的看法從引腳縮小,然後移動並放大回到用戶位置。我目前的代碼只是前往當前位置。我怎麼做,從引腳縮小,然後旅行,最後放大?預先感謝您..

回答

2

試試這個:

[_mapView setCenterCoordinate:pinCoordinate zoomLevel:minZoomValue animated:YES]; 

(應該從腳輸出縮放地圖)

然後調用:

mapview.showsUserLocation = YES; 
[mapview setCenterCoordinate:mapview.userLocation.coordinate animated:YES]; 

到地圖放大到用戶的座標。 (或者你可以設置所需的縮放級別,如上所示)

+1

它讓我錯誤的引腳和zoomLevel的代碼 – snksnk 2012-08-18 05:58:33

+0

你用你正在縮小的引腳的座標替換「pinCoordinate」嗎? – TrevorL 2012-08-22 01:23:29