Is there any way to alignment left or right
asadali737 opened this issue ยท 3 comments
asadali737 commented
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 commented
I have been trying to implement it to left. Were you able to find any solution? @asadali737
rmnblm commented
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
}