2013-03-28 90 views
22

我正在使用UIPageViewController來顯示4個其他ViewControllers。所以我的RootViewController是一個PageViewController,它顯示了我在故事板中創建的其他4個ViewController,並將其與不同視圖的segues相關聯。所有作品都很完美但是,是否可以將UIPageControl添加到此PageViewController中。無論如何,這可能嗎?UIPageViewController與PageControl

或者有人想法我怎麼能達到類似的結果?

會很好,謝謝!

+0

你使用了什麼教程,我想做同樣的事情? – 2014-01-02 19:51:34

回答

38

您需要實現這些UIPageViewControllerDataSource方法:

- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController 

- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController 

,你會得到展示在您的UIPageViewController底部36px一個頁面控制。如果看不到它們,請嘗試將視圖的顏色更改爲深色。

+0

謝謝這工作完美! – 2013-03-30 12:06:13

+0

有趣的是,你的問題也幫助了我 - 我把這段代碼當作樣板,並且想知道爲什麼我的視圖底部有一條白色條紋。所以也謝謝:) – yjsoon 2013-03-31 07:29:43

+1

哈哈很高興聽到它也幫助你:) - 你知道如果你可以改變點的顏色?以及如何隱藏底部的黑色條紋?那可能嗎?謝謝 – 2013-03-31 12:14:28