Skip to content

Commit 9815a90

Browse files
committed
Add new offFillColor property.
1 parent daa79bc commit 9815a90

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Classes/BEMCheckBox.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ typedef NS_ENUM(NSInteger, BEMAnimationType) {
100100
*/
101101
@property (strong, nonatomic) IBInspectable UIColor *onFillColor;
102102

103+
/** The color of the inside of the box when it is Off.
104+
*/
105+
@property (strong, nonatomic) IBInspectable UIColor *offFillColor;
106+
103107
/** The color of the check mark when it is On.
104108
*/
105109
@property (strong, nonatomic) IBInspectable UIColor *onCheckColor;

Classes/BEMCheckBox.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ - (void)commonInit {
5555
_hideBox = NO;
5656
_onTintColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
5757
_onFillColor = [UIColor clearColor];
58+
_offFillColor = [UIColor clearColor];
5859
_onCheckColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
5960
_tintColor = [UIColor lightGrayColor];
6061
_lineWidth = 2.0;
@@ -160,6 +161,11 @@ - (void)setOnFillColor:(UIColor *)onFillColor {
160161
[self reload];
161162
}
162163

164+
- (void)setOffFillColor:(UIColor *)offFillColor {
165+
_offFillColor = offFillColor;
166+
[self reload];
167+
}
168+
163169
- (void)setOnCheckColor:(UIColor *)onCheckColor {
164170
_onCheckColor = onCheckColor;
165171
[self reload];
@@ -224,10 +230,9 @@ - (void)drawOffBox {
224230
self.offBoxLayer = [CAShapeLayer layer];
225231
self.offBoxLayer.frame = self.bounds;
226232
self.offBoxLayer.path = [self.pathManager pathForBox].CGPath;
227-
self.offBoxLayer.fillColor = [UIColor clearColor].CGColor;
233+
self.offBoxLayer.fillColor = self.offFillColor.CGColor;
228234
self.offBoxLayer.strokeColor = self.tintColor.CGColor;
229235
self.offBoxLayer.lineWidth = self.lineWidth;
230-
231236
self.offBoxLayer.rasterizationScale = 2.0 * [UIScreen mainScreen].scale;
232237
self.offBoxLayer.shouldRasterize = YES;
233238

0 commit comments

Comments
 (0)