2012-05-13 11 views
0

long/latを入力して、入力した場所を示すMapViewを更新したいとします。他の方法で作業する場所

MapKitとCoreLocationを使用して現在の場所を表示する方法については、多くの優れた例がありますが、それ以外の方法では動作しないものは見つかりませんでした。

誰でもあなたが長い/緯度を入力して答えを表示できる例を知っていますか?

TIA

答えて

0

は、それは簡単な答えなので、多分それはあなたがそれを見つけられませんでした理由です。あなたが行う必要があるのは、緯度&の経度座標に基づいてMapViewに地域を提供することです。

それは次のようになります。

- (void)centerMapOnLocation:(id)sender{ 
    CLLocationCoordinate2D center; 
    center.latitude = ......; // conversion and origin of data left to the reader 
    center.longitude = .......; // conversion and origin of data left to the reader 
    //Span of the région we want to display 
    MKCoordinateSpan span; 
    span.latitudeDelta = 0.1f; 
    span.longitudeDelta = 0.1f; 
    //Region you actually want to display 
    MKCoordinateRegion aRegion; 
    aRegion.center = center; 
    aRegion.span = span; 

    //Everything 's ready, let's move the map to the right place 
    [mapView setRegion:aRegion animated:YES]; 
} 
+0

感謝を。私は似たようなことを試しましたが、あなたの明示的な例を明日使って再テストします。 –

+0

はい、それは動作し始めています - 非常に多くのありがとう。 –

関連する問題