2016-06-16 9 views
0

ナビゲーションコントローラ内でUIPageViewControllerを使用しています。ナビゲーションバーは、ユーザーがビューにタッチすると表示されます。ユーザーがスワイプしてページを変更すると、ナビゲーションバーが非表示になります。それ、どうやったら出来るの?私は以下のコードを試しましたが、うまく動作していないようです。ページフリップでナビゲーションバーを非表示にする

let currentViewController = self.pageViewController!.viewControllers![0] 
let viewControllers = [currentViewController] 
self.pageViewController!.setViewControllers(
    viewControllers, 
    direction: .Forward, 
    animated: true, completion: { 
     done in self.navigationController?.setNavigationBarHidden(true, animated: false) 
}) 

答えて

0

をスワイプするときにユーザが到達したページのviewWillAppearメソッドでこれを入れてみてください、私はこの機能を追加し、今では試してみました

func pageViewController(pageViewController: UIPageViewController, willTransitionToViewControllers pendingViewControllers: [UIViewController]) { 
     self.navigationController?.setNavigationBarHidden(true, animated: true) 
} 
0

self.navigationController?.setNavigationBarHidden(true, animated: true) 
+0

うんが..動作していない作品 –

関連する問題