From d1fd04bad67d49232e99b76e46f3b9c9f5c585a4 Mon Sep 17 00:00:00 2001 From: Christopher Bowns Date: Tue, 5 Jun 2012 12:23:53 -0700 Subject: [PATCH 1/3] Tweak sizing and spacing to match defaults of UIPageControl --- Classes/DDPageControl.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/DDPageControl.m b/Classes/DDPageControl.m index 53111d2..decf7f3 100644 --- a/Classes/DDPageControl.m +++ b/Classes/DDPageControl.m @@ -9,8 +9,8 @@ #import "DDPageControl.h" -#define kDotDiameter 4.0f -#define kDotSpace 12.0f +#define kDotDiameter 5.0f +#define kDotSpace 11.0f @implementation DDPageControl @@ -282,4 +282,4 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [self sendActionsForControlEvents: UIControlEventValueChanged] ; } -@end \ No newline at end of file +@end From f2b72ffa3a10e03cf470015949f4884cef6b1a57 Mon Sep 17 00:00:00 2001 From: Christopher Bowns Date: Tue, 5 Jun 2012 13:06:24 -0700 Subject: [PATCH 2/3] UIPageControl's inactive image is white:1.0 alpha:0.3 --- Classes/DDPageControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/DDPageControl.m b/Classes/DDPageControl.m index decf7f3..37037ed 100644 --- a/Classes/DDPageControl.m +++ b/Classes/DDPageControl.m @@ -86,7 +86,7 @@ - (void)drawRect:(CGRect)rect // get the caller's colors it they have been set or use the defaults UIColor *drawOnColor = onColor ? onColor : [UIColor colorWithWhite: 1.0f alpha: 1.0f]; - UIColor *drawOffColor = offColor ? offColor : [UIColor colorWithWhite: 0.7f alpha: 0.5f]; + UIColor *drawOffColor = offColor ? offColor : [UIColor colorWithWhite: 1.0f alpha: 0.3f]; // actually draw the dots for (int i = 0 ; i < numberOfPages ; i++) From 44178911942cbe80b37b5a679bcc3a34e4d64ec2 Mon Sep 17 00:00:00 2001 From: Christopher Bowns Date: Tue, 5 Jun 2012 13:10:37 -0700 Subject: [PATCH 3/3] Default values now pixel-match UIPageControl --- Classes/DDPageControl.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/DDPageControl.m b/Classes/DDPageControl.m index 37037ed..0efe855 100644 --- a/Classes/DDPageControl.m +++ b/Classes/DDPageControl.m @@ -83,6 +83,7 @@ - (void)drawRect:(CGRect)rect CGFloat dotsWidth = self.numberOfPages * diameter + MAX(0, self.numberOfPages - 1) * space ; CGFloat x = CGRectGetMidX(currentBounds) - dotsWidth / 2 ; CGFloat y = CGRectGetMidY(currentBounds) - diameter / 2 ; + y += 0.5f; // Bump down to match UIPageControl // get the caller's colors it they have been set or use the defaults UIColor *drawOnColor = onColor ? onColor : [UIColor colorWithWhite: 1.0f alpha: 1.0f];