2016-10-05 3 views
0

나는 하루 종일 이것을 연구 해왔다. 이것에 관한 많은 게시물이 있지만 나에게 도움이되는 것을 발견하지 못했다!UIPageViewController에서 왼쪽/오른쪽 스크롤을 사용하지 않으려면 어떻게해야합니까?

두 개의보기 (루트보기가 아님)를 표시하는 UIPageViewController가 있습니다.

기본적으로 내가 UIPageViewController 내부에서 뷰 중 하나에서 함수를 추가 할 때 스크롤을 비활성화 할 수 있기를 원합니다 ...?

어쨌든 가능합니까?!

도움을 주신 모든 분들께 미리 감사드립니다.

답변

0

방금 ​​해결책을 찾았습니다! 페이지 뷰 컨트롤러에서

, 당신의 아이 뷰 컨트롤러에서

override func viewDidLoad(){ 
     super.viewDidLoad() 
     NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(yourpageviewcontroller.enableSwipe(_:)), name:"enableSwipe", object: nil) 
     NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(yourpageviewcontroller.disableSwipe(_:)), name:"disableSwipe", object: nil) 

    } 
    func disableSwipe(notification: NSNotification){ 
     self.dataSource = nil 
    } 

func enableSwipe(notification: NSNotification){ 
    self.dataSource = self 
} 

를 다음을 추가, 당신은 단지에 따라 알림을 게시 할 수 있습니다.

NSNotificationCenter.defaultCenter().postNotificationName("enableSwipe", object: nil) 

또는

NSNotificationCenter.defaultCenter().postNotificationName("disableSwipe", object: nil) 
관련 문제