Custom Page Control with Paging Scrollview

895 views Asked by At

Instead of the standard dots that Apple provides for a page control, I want to have something like this. However I don't want it to be in an infinite loop were you can circle around. All I care about is the scrollable text on top, not the parallax image.

enter image description here

Currently I have a paging scrollview that contains three view controllers so my custom page control will have only three words: Main, Today, Settings.

The way I see this being built is the following:

  • Subclass UIView and insert three UIButton's and evenly space them. The title of the buttons will be Main, Today, Settings.
  • Insert this UIView as child of scrollview (or maybe not)
  • Make UIView the width of the iPhone screen
  • Not sure about here now -> as you scroll the scrollview shift the UIView on and off the screen so that the UIButton will be centered in one of the view controllers in the scrollview.

Am I on right track or does anyone have a demo to this?

1

There are 1 answers

1
Sivajee Battina On

Yes. You are on right track. You can use scrollView for this exact purpose. You have to make use of scrollViewDelegate methods for this. The below link will explain you how to do that.

How to make Paging with scrollView.