AdvancedPageControl icon indicating copy to clipboard operation
AdvancedPageControl copied to clipboard

Is there any way to alignment left or right

Open asadali737 opened this issue 3 years ago • 3 comments

First of all, great work!!! 👍

Secondly, there's no alignment property available to align the pageControlView to left or to right. It always by default displayed on the center of the container view. Is there any way to achieve this?

asadali737 avatar Jun 08 '22 03:06 asadali737

I have been trying to implement it to left. Were you able to find any solution? @asadali737

iamsanketray123 avatar Jun 30 '22 07:06 iamsanketray123

Use this for a left alignment:

func getCenteredXPosition(_ rect: CGRect, itemPos: CGFloat, dotSize: CGFloat, space: CGFloat, numberOfPages: Int) -> CGFloat {
  let individualDotPos = (itemPos * (dotSize + space))
  return individualDotPos
}

And this for a right alignment:

func getCenteredXPosition(_ rect: CGRect, itemPos: CGFloat, dotSize: CGFloat, space: CGFloat, numberOfPages: Int) -> CGFloat {
  let individualDotPos = (itemPos * (dotSize + space))
  let allDotsWidth = (CGFloat(numberOfPages) * dotSize + CGFloat(numberOfPages - 1) * space)
  return rect.width + individualDotPos - allDotsWidth
}

rmnblm avatar Apr 19 '23 09:04 rmnblm

@rmnblm Thanks for your solution, It's working perfectly.

Do you have any idea about how can I increase the width of selected page?

uzair045 avatar Apr 19 '23 10:04 uzair045