-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBPBUpArrowView.m
71 lines (47 loc) · 1.83 KB
/
BPBUpArrowView.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
62
63
64
65
66
67
68
69
70
71
//
// BPBUpArrowView.m
// iCare2
//
// Created by billy bray on 6/5/14.
// Copyright (c) 2014 Spartan Systems Inc. All rights reserved.
//
#import "BPBUpArrowView.h"
@implementation BPBUpArrowView
- (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
{
[super drawRect:rect];
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 255.0, 1.0);
CGPoint center = self.center;
// Draw them with a 2.0 stroke width so they are a bit more visible.
CGContextSetLineWidth(context, 2.0f);
CGContextMoveToPoint(context, center.x, center.y+5); //start at this point
CGContextAddLineToPoint(context, center.x, center.y-5); //draw to this point
CGContextMoveToPoint(context, center.x-5, center.y+5); // Prepare to draw left side arrow
CGContextAddLineToPoint(context, center.x, center.y-5); // draw left arrow side to center top
CGContextAddLineToPoint(context, center.x+5, center.y+5); // draw right side of arrow
// and now draw the Path!
CGContextStrokePath(context);
// if selected property is set then we need a circle
if (self.selected) {
CGContextRef context = UIGraphicsGetCurrentContext();
// Set the border width
CGContextSetLineWidth(context, 2.0);
// Set the cicle border color to BLUE
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 255.0, 1.0);
// Draw the circle border
CGContextStrokeEllipseInRect(context, rect);
}
}
@end