Creating a Vertical UIPageControl

时光总嘲笑我的痴心妄想 提交于 2019-12-20 19:39:04

问题


Anyone have an idea how to create a vertical UIPageControl? I have a UIScrollView with pagination enabled and I would like to have the UIPageControl sit on the side and appear vertically instead of horizontally.

Thank you in advance...


回答1:


You can apply a rotation transformation to the UIPageControl.

pageControl.transform = CGAffineTransformMakeRotation(M_PI_2);

Swift 3.0

let angle = CGFloat(M_PI_2)
pageControl.transform = CGAffineTransform(rotationAngle: angle)

Swift 4.0

let angle = CGFloat.pi/2
    pageControl.transform = CGAffineTransform(rotationAngle: angle)



回答2:


Update for Swift 3.1

pageControl.transform = pageControl.transform.rotated(by: .pi/2)



回答3:


You can use UICollectionView with paging enabled and vertical scroll. This handles the vertical pagination automatically.



来源:https://stackoverflow.com/questions/4927974/creating-a-vertical-uipagecontrol

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