Swift PageControl larger dot on current page

余生颓废 提交于 2020-01-11 12:51:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!