Objective c 如何在MKMapView中设置PlaceMark位置?

Objective c 如何在MKMapView中设置PlaceMark位置?,objective-c,mkmapview,Objective C,Mkmapview,MKMapView在地图视图的中心显示管脚,我想将管脚位置定位在中心上方。我该怎么做 这是我的代码 - (void) location { MKCoordinateRegion region; MKCoordinateSpan span; span.latitudeDelta = 0.1162; span.longitudeDelta = 0.1160; CLLocationCoordinate2D location; loc

MKMapView在地图视图的中心显示管脚,我想将管脚位置定位在中心上方。我该怎么做

这是我的代码

- (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];  
}

如果您希望将销保持在这些坐标上,但地图的中心位置低于销,使销略高于中心位置,请将
区域的
中心偏移

与此相反:

region.center=location;
这样做:

region.center = CLLocationCoordinate2DMake(
                    location.latitude - (span.latitudeDelta/5.0), 
                    location.longitude);
增加/减少除数以减少/增加偏移量


此外,行
[mapView RegionAtfits:region],您可以将其删除。

首先,
setRegion
本身已经执行了
regionatfits
本身,其次,
regionatfits
返回一个值,但代码没有处理任何返回值。

我明白了!但我发现你的代码有错误。错误消息:架构i386的未定义符号:“\u CLLocationCoordination2dMake”,引用自:快速问题,地图开始后如何显示标题?如果您的意思是在添加注释后立即显示标注,请参阅以下答案: