Skip to content

Commit

Permalink
Reset minHeight when applying a built-in style rather than initializi…
Browse files Browse the repository at this point in the history
…ng it to 36.0f without regard to the style. While both styles use the same default height this may be useful to other styles in the future.
  • Loading branch information
idpaterson committed Oct 24, 2013
1 parent f4fa3bc commit e4ca1b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion SMPageControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@

#define DEFAULT_INDICATOR_WIDTH 6.0f
#define DEFAULT_INDICATOR_MARGIN 10.0f
#define DEFAULT_MIN_HEIGHT 36.0f

#define DEFAULT_INDICATOR_WIDTH_LARGE 7.0f
#define DEFAULT_INDICATOR_MARGIN_LARGE 9.0f
#define DEFAULT_MIN_HEIGHT_LARGE 36.0f

typedef NS_ENUM(NSUInteger, SMPageControlImageType) {
SMPageControlImageTypeNormal = 1,
Expand Down Expand Up @@ -76,7 +78,6 @@ - (void)_initialize
{
_numberOfPages = 0;
_tapBehavior = SMPageControlTapBehaviorStep;
_minHeight = 36.0f;

self.backgroundColor = [UIColor clearColor];

Expand Down Expand Up @@ -399,12 +400,14 @@ - (void)setStyleWithDefaults:(SMPageControlStyleDefaults)defaultStyle
self.indicatorDiameter = DEFAULT_INDICATOR_WIDTH_LARGE;
self.indicatorMargin = DEFAULT_INDICATOR_MARGIN_LARGE;
self.pageIndicatorTintColor = [[UIColor whiteColor] colorWithAlphaComponent:0.2f];
self.minHeight = DEFAULT_MIN_HEIGHT_LARGE;
break;
case SMPageControlDefaultStyleClassic:
default:
self.indicatorDiameter = DEFAULT_INDICATOR_WIDTH;
self.indicatorMargin = DEFAULT_INDICATOR_MARGIN;
self.pageIndicatorTintColor = [[UIColor whiteColor] colorWithAlphaComponent:0.3f];
self.minHeight = DEFAULT_MIN_HEIGHT;
break;
}
}
Expand Down

0 comments on commit e4ca1b1

Please sign in to comment.