2
MKMapView顯示mapView中心的針腳,我想將針腳位置放在中心上方。我怎麼做?如何在MKMapView中設置PlaceMark位置?
這裏是我的代碼
- (void) location
{
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 0.1162;
span.longitudeDelta = 0.1160;
CLLocationCoordinate2D location;
location.latitude = 65.494806;
location.longitude = -23.577569;
region.span=span;
region.center=location;
PlaceMark *add_Annotation = [[[PlaceMark alloc] initWithCoordinate:location] autorelease];
[add_Annotation setTitle:@"myTitle"];
[add_Annotation setSubTitle:@"myAddress"];
[mapView addAnnotation:add_Annotation];
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
}
我明白了!但是我的代碼出錯了。錯誤消息:體系結構i386的未定義符號: 「_CLLocationCoordinate2DMake」,引用來自: – HardCode
將Core Location框架添加到項目中。 – Anna
謝謝,工作正常! – HardCode