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

CGPath misplaced #17

Open
cepages opened this issue Sep 5, 2016 · 0 comments
Open

CGPath misplaced #17

cepages opened this issue Sep 5, 2016 · 0 comments

Comments

@cepages
Copy link

cepages commented Sep 5, 2016

I'm using FXPageControl with iOS 9 with CGPath:

self.pagecontrol.numberOfPages = self.maxIndex;
    self.pagecontrol.currentPage = self.index;

    int widthPageControl = (self.pagecontrol.bounds.size.width - ((self.maxIndex - 1) * SPACING_PAGE_CONTROL) ) / self.maxIndex;

    CGMutablePathRef path = CGPathCreateMutable();
    CGPathAddRect(path, NULL, CGRectMake(0, 0, widthPageControl, HEIGHT_PAGE_CONTROL));
    CGPathCloseSubpath(path);
    self.pagecontrol.dotShape = path;
    self.pagecontrol.dotSize = widthPageControl;
    self.pagecontrol.dotColor = [UIColor blueColor];
    self.pagecontrol.dotSpacing = SPACING_PAGE_CONTROL;

    self.pagecontrol.selectedDotShape = path;
    self.pagecontrol.selectedDotSize = widthPageControl;
    self.pagecontrol.selectedDotColor = [UIColor orangeColor];

    CGPathRelease(path);

The interesting thing is the first CGPath is misplaced and diving in the code I found this is the problem:

      CGFloat offset = (_dotSize + _dotSpacing) * i + _dotSize / 2;

so changing this to:

      CGFloat offset = (_dotSize + _dotSpacing) * i;

Why do you need all the time _dotSize / 2?

Images with _dotSize / 2;

screen shot 2016-09-05 at 16 42 11
screen shot 2016-09-05 at 16 42 27

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

1 participant