views:

24

answers:

1

Hi I want to incease the size of UIPAgeControl on iOS... on google i've found this http://www.onidev.com/2009/12/02/customisable-uipagecontrol/

was wondering is there any other way....?

A: 

I used this code:

Source: http://apptech.next-munich.com/2010/04/customizing-uipagecontrols-looks.html

// header
@interface StyledPageControl : UIPageControl { }

@end

// implementation
@implementation StyledPageControl

- (void) setCurrentPage:(NSInteger)page {
 [super setCurrentPage:page];

 NSString* imgActive = [[NSBundle mainBundle] pathForResource:IMG_PAGE_ACTIVE ofType:nil];
 NSString* imgInactive = [[NSBundle mainBundle] pathForResource:IMG_PAGE_INACTIVE ofType:nil];
 for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
  UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
  if (subviewIndex == page) [subview setImage:[UIImage imageWithContentsOfFile:imgActive]];
  else [subview setImage:[UIImage imageWithContentsOfFile:imgInactive]];
 }
}

- (void) setNumberOfPages:(NSInteger)pages {
 [super setNumberOfPages:pages];

 NSString* img = [[NSBundle mainBundle] pathForResource:IMG_PAGE_INACTIVE ofType:nil];
 for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
  UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
  [subview setImage:[UIImage imageWithContentsOfFile:img]];
 }
}

@end
meersmans