На самом деле, я пытаюсь удалить устаревший код из своего приложения (изменение целевого развертывания с iOS6 на iOS7) и ищу альтернативы. Вот старый код:
- (void) mapTapped:(UITapGestureRecognizer *)sender
{
CMELog(@"mapTapped");
if (sender.state != UIGestureRecognizerStateEnded)
return;
CGPoint mapTouchPoint = [sender locationInView:mainMapView];
CLLocationCoordinate2D mapTouchCoord = [mainMapView convertPoint:mapTouchPoint toCoordinateFromView:mainMapView];
MKMapPoint touchMapPoint = MKMapPointForCoordinate(mapTouchCoord);
CMELog(@"touchMapPoint: x:%f, y:%f", touchMapPoint.x, touchMapPoint.y);
// this is where things can get inefficient if you have loads of overlayViews that aren't even visible!
for (id<MKOverlay> overlay in self.mainMapView.overlays)
{
MKOverlayView *overlayView = [self.mainMapView viewForOverlay:overlay];
CGSize overlayViewSize = overlayView.frame.size;
CGPoint touchPoint = [sender locationInView:overlayView];
// check to see if the point is within the overlay bounding box first
if (touchPoint.x > 0 && touchPoint.x < overlayViewSize.width && touchPoint.y > 0 && touchPoint.y < overlayViewSize.height)
{
}
}
}
Я заменил первую строку в цикле на следующую:
MKOverlayRenderer *rendererOverlay = [self.mainMapView rendererForOverlay:overlay];
Но я не мог найти, как получить кадр рендер-оверлея. Любая идея, пожалуйста?