I'm building a simple walkthrough at the beginning of my app. This walkthrough needs to be accessible to voiceOver users. In other apps, I've noticed that visually impaired users can swipe up and down on UIPageControl and travel between different view controllers.
Here's the code I have the moment, this is in my UIPageViewController, is there a particular property i need to set?
func configurePageControl() {
// The total number of pages that are available is based on how many available colors we have.
pageControl = UIPageControl(frame: CGRect(x: 0,y: UIScreen.main.bounds.maxY - 150,width: UIScreen.main.bounds.width,height: 50))
self.pageControl.numberOfPages = orderedViewControllers.count
self.pageControl.currentPage = 0
self.pageControl.tintColor = UIColor.white
self.pageControl.pageIndicatorTintColor = UIColor.black
self.pageControl.currentPageIndicatorTintColor = UIColor.white
self.view.addSubview(pageControl)
pageControl.isUserInteractionEnabled = true
pageControl.isAccessibilityElement = true
}
And this is my viewDidLoad()
:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.dataSource = self
self.delegate = self
configurePageControl()
if let firstViewController = orderedViewControllers.first {
setViewControllers([firstViewController],
direction: .forward,
animated: true,
completion: nil)
}
}
I'm instantiating this pageControl element programmatically and not dragging this from the storyboard.
Thanks!