Skip to content

Commit 0b10b0c

Browse files
authored
Merge pull request Boris-Em#46 from Boris-Em/feature/offColor
Add new offFillColor property.
2 parents 76524b0 + 9815a90 commit 0b10b0c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Classes/BEMCheckBox.h

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

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

Classes/BEMCheckBox.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ - (void)commonInit {
6868
_hideBox = NO;
6969
_onTintColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
7070
_onFillColor = [UIColor clearColor];
71+
_offFillColor = [UIColor clearColor];
7172
_onCheckColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
7273
_tintColor = [UIColor lightGrayColor];
7374
_lineWidth = 2.0;
@@ -185,6 +186,11 @@ - (void)setOnFillColor:(UIColor *)onFillColor {
185186
[self reload];
186187
}
187188

189+
- (void)setOffFillColor:(UIColor *)offFillColor {
190+
_offFillColor = offFillColor;
191+
[self reload];
192+
}
193+
188194
- (void)setOnCheckColor:(UIColor *)onCheckColor {
189195
_onCheckColor = onCheckColor;
190196
[self reload];
@@ -255,10 +261,9 @@ - (void)drawOffBox {
255261
self.offBoxLayer = [CAShapeLayer layer];
256262
self.offBoxLayer.frame = self.bounds;
257263
self.offBoxLayer.path = [self.pathManager pathForBox].CGPath;
258-
self.offBoxLayer.fillColor = [UIColor clearColor].CGColor;
264+
self.offBoxLayer.fillColor = self.offFillColor.CGColor;
259265
self.offBoxLayer.strokeColor = self.tintColor.CGColor;
260266
self.offBoxLayer.lineWidth = self.lineWidth;
261-
262267
self.offBoxLayer.rasterizationScale = 2.0 * [UIScreen mainScreen].scale;
263268
self.offBoxLayer.shouldRasterize = YES;
264269

0 commit comments

Comments
 (0)