简体   繁体   English

在iOS中增加UIPageControl大小

[英]Increasing the UIPageControl Size in iOS

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/ 嗨,我想增加iOS上的UIPAgeControl的大小...在Google上,我已经找到此http://www.onidev.com/2009/12/customisable-uipagecontrol/

was wondering is there any other way....? 想知道还有没有其他方法...?

I used this code: 我使用以下代码:

Source: http://apptech.next-munich.com/2010/04/customizing-uipagecontrols-looks.html 来源: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM