Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone MapKit: Custom MKPolygonView with image draws upside down
    primarykey
    data
    text
    <p>does anybody know what to do with this problem: my image in a custom MKPolygonView is flipped upside down? </p> <p>The idea (this is working OK already) is having an class "SnowmapsOverlayView" that extends "MKPolygonView", that displays a image. This image has a default location &amp; size on the map (acts as a GroundOverlay in the Google Maps web API). This is all working fine, but the image is displayed upside down. I've tryed the following options, but with no result: </p> <p><a href="https://stackoverflow.com/questions/506622/cgcontextdrawimage-draws-image-upside-down-when-passed-uiimage-cgimage">CGContextDrawImage draws image upside down when passed UIImage.CGImage</a></p> <p>Thanks for any help or suggestions!</p> <p>My code:</p> <pre><code>#import &lt;MapKit/MapKit.h&gt; @interface SnowmapsOverlayView : MKPolygonView { } @end ----------------- #import "SnowmapsOverlayView.h" @implementation SnowmapsOverlayView -(id)initWithPolygon:(MKPolygon *)polygon { self = [super initWithPolygon:polygon]; return self; } -(void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { UIImage *image = [UIImage imageNamed:@"snowmap.png"]; //This should do the trick, but is doesn't.. maybe a problem with the "context"? //CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height); //CGContextTranslateCTM(context, 0, image.size.height); //CGContextScaleCTM(context, 1.0, -1.0); CGRect overallCGRect = [self rectForMapRect:self.overlay.boundingMapRect]; CGContextDrawImage(context, overallCGRect, image.CGImage); } -(BOOL)canDrawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale { return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload