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

Is there any way to alignment left or right #15

Open
asadali737 opened this issue Jun 8, 2022 · 3 comments
Open

Is there any way to alignment left or right #15

asadali737 opened this issue Jun 8, 2022 · 3 comments

Comments

@asadali737
Copy link

asadali737 commented Jun 8, 2022

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?

@iamsanketray123
Copy link

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

@rmnblm
Copy link

rmnblm commented Apr 19, 2023

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
}

@uzair045
Copy link

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

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

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

4 participants