Skip to content

Commit

Permalink
Merge pull request #46 from Boris-Em/feature/offColor
Browse files Browse the repository at this point in the history
Add new offFillColor property.
  • Loading branch information
Boris-Em authored Nov 19, 2016
2 parents 76524b0 + 9815a90 commit 0b10b0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Classes/BEMCheckBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ typedef NS_ENUM(NSInteger, BEMAnimationType) {
*/
@property (strong, nonatomic) IBInspectable UIColor *onFillColor;

/** The color of the inside of the box when it is Off.
*/
@property (strong, nonatomic) IBInspectable UIColor *offFillColor;

/** The color of the check mark when it is On.
*/
@property (strong, nonatomic) IBInspectable UIColor *onCheckColor;
Expand Down
9 changes: 7 additions & 2 deletions Classes/BEMCheckBox.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ - (void)commonInit {
_hideBox = NO;
_onTintColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
_onFillColor = [UIColor clearColor];
_offFillColor = [UIColor clearColor];
_onCheckColor = [UIColor colorWithRed:0 green:122.0/255.0 blue:255/255 alpha:1];
_tintColor = [UIColor lightGrayColor];
_lineWidth = 2.0;
Expand Down Expand Up @@ -185,6 +186,11 @@ - (void)setOnFillColor:(UIColor *)onFillColor {
[self reload];
}

- (void)setOffFillColor:(UIColor *)offFillColor {
_offFillColor = offFillColor;
[self reload];
}

- (void)setOnCheckColor:(UIColor *)onCheckColor {
_onCheckColor = onCheckColor;
[self reload];
Expand Down Expand Up @@ -255,10 +261,9 @@ - (void)drawOffBox {
self.offBoxLayer = [CAShapeLayer layer];
self.offBoxLayer.frame = self.bounds;
self.offBoxLayer.path = [self.pathManager pathForBox].CGPath;
self.offBoxLayer.fillColor = [UIColor clearColor].CGColor;
self.offBoxLayer.fillColor = self.offFillColor.CGColor;
self.offBoxLayer.strokeColor = self.tintColor.CGColor;
self.offBoxLayer.lineWidth = self.lineWidth;

self.offBoxLayer.rasterizationScale = 2.0 * [UIScreen mainScreen].scale;
self.offBoxLayer.shouldRasterize = YES;

Expand Down

0 comments on commit 0b10b0c

Please sign in to comment.