-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBPBSlideView.m
61 lines (47 loc) · 1.54 KB
/
BPBSlideView.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
//
// BPBSlideView.m
// Origins
//
// Created by billy bray on 5/16/14.
// Copyright (c) 2014 Spartan Systems. All rights reserved.
//
#import "BPBSlideView.h"
@implementation BPBSlideView
- (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
{
CGFloat radius = 66.0;
CGMutablePathRef path = CGPathCreateMutable();
UIColor *color;
CGContextRef context = UIGraphicsGetCurrentContext();
// Determine size
rect = self.bounds;
// Create path for callout bubble
CGPathMoveToPoint(path, NULL, rect.origin.x+rect.size.width, rect.origin.y);
CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y+rect.size.height);
// CGPathAddArc(path, NULL, rect.origin.x, rect.origin.y,
// radius, M_PI, M_PI / 2, 1);
CGPathAddArc(path, NULL, rect.origin.x + rect.size.width,
(rect.origin.y + rect.size.height)/2, radius, M_PI / 2, 0.0f, NO);
//CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y);
CGPathCloseSubpath(path);
//Fill Callout Bubble & Add Shadow
color = [[UIColor blackColor] colorWithAlphaComponent:.7];
[color setFill];
CGContextAddPath(context, path);
CGContextSaveGState(context);
CGContextFillPath(context);
CGContextRestoreGState(context);
//Cleanup
CGPathRelease(path);
}
@end