Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. class imageOverlayRenderer: MKOverlayRenderer {
  2. var bar = self.overlay
  3. }
  4.  
  5. #import <MapKit/MapKit.h>
  6.  
  7. @interface PVParkMapOverlayView : MKOverlayRenderer
  8.  
  9. - (instancetype)initWithOverlay:(id<MKOverlay>)overlay overlayImage:(UIImage *)overlayImage;
  10.  
  11. @end
  12.  
  13. #import "PVParkMapOverlayView.h"
  14.  
  15. @interface PVParkMapOverlayView ()
  16.  
  17. @property (nonatomic, strong) UIImage *overlayImage;
  18.  
  19. @end
  20.  
  21. @implementation PVParkMapOverlayView
  22.  
  23. - (instancetype)initWithOverlay:(id<MKOverlay>)overlay overlayImage:(UIImage *)overlayImage {
  24. self = [super initWithOverlay:overlay];
  25. if (self) {
  26. _overlayImage = overlayImage;
  27. }
  28.  
  29. return self;
  30. }
  31.  
  32. - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {
  33. CGImageRef imageReference = self.overlayImage.CGImage;
  34.  
  35. MKMapRect theMapRect = self.overlay.boundingMapRect;
  36. CGRect theRect = [self rectForMapRect:theMapRect];
  37.  
  38. CGContextScaleCTM(context, 1.0, -1.0);
  39. CGContextTranslateCTM(context, 0.0, -theRect.size.height);
  40. CGContextDrawImage(context, theRect, imageReference);
  41. }
  42.  
  43. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement