问题
I am attempting to scale dot of the current page to be larger than the dots which are not 'selected'.
I am using the scrollview delegate to ascertain which page is current.
At the moment there is no change to the size of the dot.
How would I go about achieving this?
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
var i = 0
if(scrollView.contentOffset.x < scrollView.frame.width){
pageControl.currentPage = 0
pageControl.subviews.forEach {
if(i == 0){
print("Edit")
$0.transform.scaledBy(x: 5, y: 5)
}
pageControl.layoutIfNeeded()
i += 1
}
}else{
pageControl.currentPage = 1
}
}
回答1:
UIPageControl is not that customizable. Use a library like this one
TAPageControl
Is works the same way as UIPageControl and you can easily customize current and non current page dots by setting the properties dotImage and currentDotImage.
来源:https://stackoverflow.com/questions/48770171/swift-pagecontrol-larger-dot-on-current-page