2016-10-06 4 views
-1

세 페이지로 PageViewController을 설정했습니다. 그러나 2 페이지 (가운데)부터 시작하겠습니다. 그러나 나는 이것을 어떻게하는지 모른다.UIPageViewController - 시작 부분이 아니라 중간에서 시작하십시오 (2 페이지)

pageViewController.setViewControllers([viewControllerAtIndex(startIndex)!], direction: .forward, animated: true, completion: nil) 

하지만 당신은 단지 directionforward 또는 reverse을 말할 수있다 :

난 당신이 이런 식으로 시작 viewController을 설정 알고있다. 그러나이 경우에는 둘 다 있습니다.

어떻게해야합니까? 고맙습니다!

+0

속성은 UIPageControll에있다 : 현재 페이지를 설정할 수 있습니다. –

+0

is is 이 속성은'pageViewController'의 속성입니까? 나는 그것을 발견 할 수 없다 – Quantm

+1

그래서, 나는 그 재산을 발견했지만 아무것도 변화시키지 않았다. 또한, 나는 페이지 컨트롤이 pageViewController와 분리되어 있다고 생각한다. (나는 생각한다.) – Quantm

답변

1

startViewController에 대한 귀하의 구현이 UIPageViewControllerDataSource 구현에서

pageViewController.setViewControllers([viewControllerAtIndex(startIndex)!], direction: .forward, animated: false, completion: nil) 

올바른지, 또한이 방법을 구현 :

func presentationIndex(for pageViewController: UIPageViewController) -> Int { 
    return startIndex 
} 

또한해야 할 수도 있습니다를

func presentationCount(for pageViewController: UIPageViewController) -> Int { 
    return pageData.count 
} 
+0

별로. 그가 시작하기를 원하는 곳부터 '애니메이트'는 '거짓'이어야합니다. – matt

+0

Thanks @matt, 답변을 업데이트했습니다. –

관련 문제