-
Notifications
You must be signed in to change notification settings - Fork 1
/
Triforce.m
45 lines (38 loc) · 1.07 KB
/
Triforce.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
//
// Triangle.m
// test
//
// Created by Satbir Tanda on 11/29/15.
// Copyright © 2015 Satbir Tanda. All rights reserved.
//
#import "Triforce.h"
@implementation Triforce
- (UIColor *)triforceColor
{
if (!_triforceColor) {
_triforceColor = [UIColor yellowColor];
}
return _triforceColor;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
UIBezierPath *trianglePath = [UIBezierPath bezierPath];
trianglePath.lineWidth = 0;
[self.triforceColor setFill];
[trianglePath moveToPoint:CGPointMake(rect.size.width/2, rect.size.height)];
[trianglePath addLineToPoint:CGPointMake(0, 0)];
[trianglePath addLineToPoint:CGPointMake(rect.size.width, 0)];
[trianglePath closePath];
[trianglePath fill];
[trianglePath stroke];
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
}
return self;
}
@end