diff --git a/RMStepsController/RMStep.h b/RMStepsController/RMStep.h index 49cf2d1..766769c 100644 --- a/RMStepsController/RMStep.h +++ b/RMStepsController/RMStep.h @@ -37,6 +37,16 @@ */ @property (nonatomic, strong) NSString *title; +/** + Provides access to the font of the title of this step as it is used by an instance of `RMStepsBar`. + */ +@property (nonatomic, strong) UIFont *titleFont; + +/** + Provides access to the font of the number index of this step as it is used by an instance of `RMStepsBar`. + */ +@property (nonatomic, strong) UIFont *numberFont; + /** Provides access to the selected bar color of this step as it is used by an instance of `RMStepsBar`. */ @@ -67,10 +77,30 @@ */ @property (nonatomic, strong) UIColor *disabledTextColor; +/** + Provides access to the selected number color of this step as it is used by an instance of `RMStepsBar`. + */ +@property (nonatomic, strong) UIColor *selectedNumberColor; + +/** + Provides access to the enabled number color of this step as it is used by an instance of `RMStepsBar`. + */ +@property (nonatomic, strong) UIColor *enabledNumberColor; + +/** + Provides access to the disabled number color of this step as it is used by an instance of `RMStepsBar`. + */ +@property (nonatomic, strong) UIColor *disabledNumberColor; + /** Provides access to the hide or show number label of this step. */ @property (nonatomic, assign) BOOL hideNumberLabel; +/** + Provides access to the filled or empty color configuration for the number label of this step. + */ +@property (nonatomic, assign) BOOL fillNumberLabel; + @end diff --git a/RMStepsController/RMStep.m b/RMStepsController/RMStep.m index 83645d8..cadc06f 100644 --- a/RMStepsController/RMStep.m +++ b/RMStepsController/RMStep.m @@ -79,11 +79,15 @@ - (UILabel *)numberLabel { if(!_numberLabel) { self.numberLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _numberLabel.text = @"0"; - _numberLabel.textColor = self.disabledTextColor; + _numberLabel.textColor = self.disabledNumberColor; _numberLabel.textAlignment = NSTextAlignmentCenter; _numberLabel.backgroundColor = [UIColor clearColor]; - _numberLabel.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]; + _numberLabel.font = self.numberFont; _numberLabel.translatesAutoresizingMaskIntoConstraints = NO; + + if (_fillNumberLabel) { + _numberLabel.textColor = [UIColor whiteColor]; + } } return _numberLabel; @@ -96,7 +100,7 @@ - (UILabel *)titleLabel { _titleLabel.textColor = self.disabledTextColor; _titleLabel.textAlignment = NSTextAlignmentLeft; _titleLabel.backgroundColor = [UIColor clearColor]; - _titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]; + _titleLabel.font = self.titleFont; _titleLabel.translatesAutoresizingMaskIntoConstraints = NO; } @@ -111,8 +115,12 @@ - (CAShapeLayer *)circleLayer { _circleLayer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius:radius].CGPath; _circleLayer.position = CGPointMake(9, 10); _circleLayer.fillColor = [UIColor clearColor].CGColor; - _circleLayer.strokeColor = self.disabledTextColor.CGColor; + _circleLayer.strokeColor = self.disabledNumberColor.CGColor; _circleLayer.lineWidth = 1; + + if (_fillNumberLabel) { + _circleLayer.fillColor = self.disabledNumberColor.CGColor; + } } return _circleLayer; @@ -174,6 +182,30 @@ - (UIColor *)disabledTextColor { return _disabledTextColor; } +- (UIColor *)selectedNumberColor { + if(!_selectedNumberColor) { + self.selectedNumberColor = [UIColor colorWithWhite:1 alpha:1]; + } + + return _selectedNumberColor; +} + +- (UIColor *)enabledNumberColor { + if(!_enabledNumberColor) { + self.enabledNumberColor = [UIColor colorWithWhite:1 alpha:1]; + } + + return _enabledNumberColor; +} + +- (UIColor *)disabledNumberColor { + if(!_disabledNumberColor) { + self.disabledNumberColor = [UIColor colorWithWhite:0.75 alpha:1]; + } + + return _disabledNumberColor; +} + - (void)setHideNumberLabel:(BOOL)hideNumberLabel { _hideNumberLabel = hideNumberLabel; diff --git a/RMStepsController/RMStepsBar.m b/RMStepsController/RMStepsBar.m index 83cfa6a..aa2e6a1 100644 --- a/RMStepsController/RMStepsBar.m +++ b/RMStepsController/RMStepsBar.m @@ -396,9 +396,14 @@ - (void)updateStepsAnimated:(BOOL)animated { void (^stepAnimations)(void) = ^(void) { step.stepView.backgroundColor = step.enabledBarColor; step.titleLabel.textColor = step.enabledTextColor; - step.numberLabel.textColor = step.enabledTextColor; - step.circleLayer.strokeColor = step.enabledTextColor.CGColor; + step.numberLabel.textColor = step.enabledNumberColor; + step.circleLayer.strokeColor = step.enabledNumberColor.CGColor; step.hideNumberLabel = NO; + + if (step.fillNumberLabel) { + step.numberLabel.textColor = [UIColor whiteColor]; + step.circleLayer.fillColor = step.enabledNumberColor.CGColor; + } }; if(animated) @@ -412,9 +417,14 @@ - (void)updateStepsAnimated:(BOOL)animated { void (^stepAnimations)(void) = ^(void) { step.stepView.backgroundColor = step.selectedBarColor; step.titleLabel.textColor = step.selectedTextColor; - step.numberLabel.textColor = step.selectedTextColor; - step.circleLayer.strokeColor = step.selectedTextColor.CGColor; + step.numberLabel.textColor = step.selectedNumberColor; + step.circleLayer.strokeColor = step.selectedNumberColor.CGColor; step.hideNumberLabel = self.hideNumberLabelWhenActiveStep; + + if (step.fillNumberLabel) { + step.numberLabel.textColor = [UIColor whiteColor]; + step.circleLayer.fillColor = step.selectedNumberColor.CGColor; + } }; if(animated) @@ -428,9 +438,14 @@ - (void)updateStepsAnimated:(BOOL)animated { void (^stepAnimations)(void) = ^(void) { step.stepView.backgroundColor = step.disabledBarColor; step.titleLabel.textColor = step.disabledTextColor; - step.numberLabel.textColor = step.disabledTextColor; - step.circleLayer.strokeColor = step.disabledTextColor.CGColor; + step.numberLabel.textColor = step.disabledNumberColor; + step.circleLayer.strokeColor = step.disabledNumberColor.CGColor; step.hideNumberLabel = NO; + + if (step.fillNumberLabel) { + step.numberLabel.textColor = [UIColor whiteColor]; + step.circleLayer.fillColor = step.disabledNumberColor.CGColor; + } }; if(animated)