- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
if ([view.annotation isKindOfClass:MKUserLocation.class]) {
[mapView deselectAnnotation:view.annotation animated:YES];
}
else {
[mapView deselectAnnotation:view.annotation animated:YES];
view.image=[UIImage imageNamed:@"pin_location_purple@2x.png"];//annotation pin
[self ToolTipView:view];//For adding the callout view
}
}
问问题
113 次
1 回答
1
有一个开源项目 ,SMCalloutView
它以类似于 MapKit 的方式解决了这个问题。在这里查看他们设置的委托协议,它允许委托根据靠近屏幕边缘调整其内容偏移:
https://github.com/nfarina/calloutview/blob/master/SMCalloutView.m#L303-L331
您可以采用类似的方法,但您必须MKMapPoint
从像素值进行一些转换才能MKMapView
类似地控制偏移量。
于 2013-09-12T17:07:11.607 回答