0
我想要一個IBAction中心我的mapview的地區的註釋。註釋添加到的MapView這樣的:如何檢索地圖註記座標?
myAnnotation *pinLoc=[[myAnnotation alloc] init];
pinLoc.coordinate = mapview.centerCoordinate;
pinLoc.title = @"Title";
pinLoc.subtitle = @"subtitle";
[mapview addAnnotation:pinLoc];
我想中檢索,並以某種方式移動該地區的中心是這樣的:
- (IBAction)findPin:(id)sender {
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = pinLoc.coordinate.latitude;
region.center.longitude = pinloc.coordinate.longitude;
region.span.latitudeDelta = 0.001f;
region.span.longitudeDelta = 0.001f;
[mapview setRegion:region animated:YES];
[mapview setDelegate:self];
}
我也在尋找一種方式來告訴我們,如果該針在多邊形內。我已經在使用用戶位置工作了,但同樣,我需要檢索引腳的座標以使其與引腳一起工作。
有時候,我看不出是正確的答案在我面前,謝謝安娜。您在StackOverflow上的存在爲我在早期的iOS開發職業生涯中爲我節省了無數次。我實際上習慣使用你的代碼來確定一個點是否在一個多邊形內! – 2012-03-20 09:23:20