-
Notifications
You must be signed in to change notification settings - Fork 0
/
PVParkMapOverlayView.m
61 lines (47 loc) · 1.32 KB
/
PVParkMapOverlayView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// PVParkMapOverlayView.m
// Park View
//
// Created by Joseph Bustamante on 3/6/13.
// Copyright (c) 2013 Chris Wagner. All rights reserved.
//
#import "PVParkMapOverlayView.h"
@interface PVParkMapOverlayView ()
@property (nonatomic, strong) UIImage *overlayImage;
@end
@implementation PVParkMapOverlayView
- (instancetype) initWithOverlay:(id<MKOverlay>)overlay overlayImage:(UIImage *)overlayImage
{
self = [super initWithOverlay:overlay];
if (self)
{
_overlayImage = overlayImage;
}
return self;
}
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context
{
CGImageRef imageReference = self.overlayImage.CGImage;
MKMapRect theMapRect = self.overlay.boundingMapRect;
CGRect theRect = [self rectForMapRect:theMapRect];
CGContextScaleCTM(context, 1.0, -1.0);
CGContextTranslateCTM(context, 0.0, -theRect.size.height);
CGContextDrawImage(context, theRect, imageReference);
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end