-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBPColorWell.m
59 lines (44 loc) · 1.02 KB
/
BPColorWell.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
//
// BPColorWell.m
// Skates
//
// Created by Jon Olson on 2/4/10.
// Copyright 2010 Source14 Platforms. All rights reserved.
//
#import "BPColorWell.h"
@interface BPColorWell (Private)
@end
@implementation BPColorWell
#pragma mark -
#pragma mark Construction and deallocation
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)dealloc {
[super dealloc];
}
#pragma mark -
#pragma mark Accessors
@synthesize color;
- (void)setColor:(UIColor *)aColor {
if (aColor != color) {
[color release];
color = [aColor retain];
[self setNeedsDisplay];
}
}
#pragma mark -
#pragma mark Drawing
- (void)drawRect:(CGRect)rect {
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetShouldAntialias(ctx, NO);
CGContextSetFillColorWithColor(ctx, color.CGColor);
CGContextFillRect(ctx, rect);
CGContextSetRGBStrokeColor(ctx, 0.45, 0.45, 0.45, 1.0);
CGContextSetLineWidth(ctx, 2.0);
CGContextStrokeRect(ctx, rect);
}
@end