1

I have implemented Page Swipe with a UIPageViewController.

Delegates and DataSource are working properly. The indexing, the whole thing.

The problem I have is, since the Page Controller is part of the UIPageViewController, its default position is at the bottom. Since it is part of it, I can not change it on the storyboard.

Could anyone point me in the right direction?

I tried this, but didn't work

   self.view.frame = CGRect(origin: CGPoint(x: 0.0, y: 30.0), size: CGSize(width: self.view.frame.width, height: self.view.frame.size.height - 200.0))

Also tried this. But all it did was create a second PageControl

    let pageControl = UIPageControl()
pageControl.pageIndicatorTintColor = UIColor.grayColor()
pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
pageControl.backgroundColor = UIColor.darkGrayColor()
pageControl.numberOfPages = 4
pageControl.center = self.view.center
self.view.addSubview(pageControl)

pageControl.layer.position.y = self.view.frame.height - 200; 
// 200 point from bottom of the screen

I have googled it, but didn't find anything useful. Thanks

1 Answers1

0

There are two possible solutions:

  1. Update current UIPageControl's position in UIPageViewController's viewDidLayoutSubviews like it's shown here
  2. Create your own UIPageControl and do not use the default one

Personally, I don't like hacking system controls, so I'd prefer to create a new one and customize it as I want. Good luck!

denys
  • 31
  • 1
  • 1
  • So you're saying to create a new one? Option 2? Is there a reason I should not hack it? – NateJacbob127b May 15 '19 at 12:00
  • I tried that example, but I don't know where the solution provider is getting the .pageIndex from. on the line that has pageControl.currentPage = pageContentView?.pageIndex .Do you happen to know? – NateJacbob127b May 15 '19 at 12:33