How to access the Overlay object boundingMapRect at the OverlayView?
I'm trying to place images on top of Google Maps and I'm having trouble to fetch the overlay's boundingMapRect. The odd thing is that when I check the 'overlay' with the debugger the correct data is there, but when I try to print it - its garbage.
This is the printing code:
MKMapRect overlayRect = [self.overlay boundingMapRect];
NSLog(@"\n\n\n");
NSLog(@"drawMapRect: overlay: x: %f, y: %f, w: %f, h: %f",
MKMapRectGetMinX([overlay boundingMapRect]),
MKMapRectGetMinY([overlay boundingMapRect]),
MKMapRectGetWidth([overlay boundingMapRect]),
MKMapRectGetHeight([overlay boundingMapRect]));
NSLog(@"drawMapRect: boundingMapRect x: %f, boundingMapRect y: %f, boundingMapRect w: %f, boundingMapRect h: %f",
[overlay boundingMapRect].origin.x,
[overlay boundingMapRect].origin.y,
[overlay boundingMapRect].size.width,
[overlay boundingMapRect].size.height);
NSLog(@"drawMapRect: boundingMapRect x: %f, boundingMapRect y: %f, boundingMapRect w: %f, boundingMapRect h: %f",
self.overlay.boundingMapRect.origin.x,
((MKOverlayView *)self).overlay.boundingMapRect.origin.y,
[overlay boundingMapRect].size.width,
[overlay boundingMapRect].size.height);
It is placed at
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context.
Any help would be great. A small example of image drawing over a map with Core Graphics will be aw开发者_C百科esome.
Thanks, Tzur.
SOLVED
The way to access a property of a class from which I inherit is to use 'super'. or, in my case, [super overlay].
精彩评论