ZZPageControl.m 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // ZZPageControl.m
  3. // XPH
  4. //
  5. // Created by Zick.Zhao on 15/3/24.
  6. // Copyright (c) 2015年 YAY. All rights reserved.
  7. //
  8. #import "ZZPageControl.h"
  9. @implementation ZZPageControl
  10. /*
  11. // Only override drawRect: if you perform custom drawing.
  12. // An empty implementation adversely affects performance during animation.
  13. - (void)drawRect:(CGRect)rect {
  14. // Drawing code
  15. }
  16. */
  17. -(id) initWithFrame:(CGRect)frame dotSize:(CGSize)_dotSize
  18. {
  19. self = [super initWithFrame:frame];
  20. dotSize = _dotSize;
  21. return self;
  22. }
  23. - (void) setCurrentPage:(NSInteger)page {
  24. [super setCurrentPage:page];
  25. for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
  26. UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
  27. [subview setFrame:CGRectMake(subview.frame.origin.x, subview.frame.origin.y,
  28. dotSize.width,dotSize.height)];
  29. [subview.layer setCornerRadius:dotSize.width/2];
  30. [subview.layer setMasksToBounds:YES];
  31. }
  32. }
  33. @end