Open ErwannRobin opened 12 years ago
I've added a category in my code to do this. This would be good to get it in the official code:
#define CLASSIC_DOTS_BY_SCREEN 20
@implementation DDPageControl (DynamicSize)
// When I have too much memories, I need to display the dots in a smaller way
-(void) updatePageControlSize {
if (self.numberOfPages > CLASSIC_DOTS_BY_SCREEN) {
int divide = self.numberOfPages / CLASSIC_DOTS_BY_SCREEN + 1;
// Change the diameter and space so all dots can enter in the page
// Note that I use constants because I can't add variables such as originalDiameter and originalSpace to calculate the correct size depending on self.indicatorDiameter and self.indicatorSpace the developper entered
self.indicatorDiameter = 4.0f / divide;
self.indicatorSpace = 12.0f / divide;
}
}
@end
If i add a lot of pages, the DDPageControl component extend its size beyond the size of the device. I am trying to limit the width of the component, but how can I still show to the user where he is in the scrollview ?