Search code examples
iosuipagecontrol

Create Controller similar to Page Controller ( not sure what its called or if it exists as is)


I want to create something similar to a Page Controller. Let me explain the whole picture. In my app's about page, I want to display a portion of the page that links to my other apps. In this small portion of the page, I want to display 3 icons at a time(of say 9 in total). Now, this portion can be a page controller and all will work well. Except, here, I want the user to be able to slide his finger from right to left on the view, hence, sliding the second view in.

Say I have 9 apps, I will require 3 views each containing 3 app icons. Now the User slides his finger across the screen to show the second view (containing icon no 4,5,6).

This is similar to the page controller, except (as far as I know, and I am a newbie) the page controller requires you to click on the circles at the bottom to get from one page to another. I want the slide option along with the basic click option of the page controller.

I know this is possible as I have seen it in some other apps. Is this a standard controller provided in Xcode, or is it something that I have to configure? Can someone please help me out? Thanks


Solution

  • As far as I know, there's no such thing as a "Page Controller". There is a UIPageControl, which is just a control that displays a row of dots, one of which is highlighted. Then there is the new UIPageViewController which displays view controllers like the pages of a book (think iBooks). It sounds like you're talking about the former.

    UIPageControl does not, by itself, display any sort of view. It has to be synchronized with some other view (usually a UIScrollView with paging enabled). Thus, one does not need to tap on one of the dots to switch pages. One can ignore such taps all together by not assigning a target to the page control's "value changed" action. In the case where a paged UIScrollView holds the content associated with the page control, you can manipulate the view by simply swiping as always.