Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to limit the width of the page control ? #5

Open
ErwannRobin opened this issue May 6, 2012 · 1 comment
Open

How to limit the width of the page control ? #5

ErwannRobin opened this issue May 6, 2012 · 1 comment

Comments

@ErwannRobin
Copy link

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 ?

@CedricSoubrie
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants