2016-02-26 82 views
1

我使用pagevew控制器的抽屜功能。每一件事情都可以正常工作,但第一次當視圖加載時,它會留下狀態欄的空間並在狀態欄下開始。我需要從Y顯示視圖= 0uipageViewController沒有加載視圖與y = 0

private func setupPageViewController() { 
    pageViewController = UIPageViewController(transitionStyle: UIPageViewControllerTransitionStyle.Scroll, navigationOrientation: UIPageViewControllerNavigationOrientation.Horizontal, options: nil) 
    pageViewController.dataSource = self 
    pageViewController.delegate = self 
    pageViewController.setViewControllers([stackPageVC[stackStartLocation]], direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil) 
    var pageViewControllerY: CGFloat = 0 
    var pageViewControllerH: CGFloat = 0 
    if navigationBarShouldNotExist { 
     pageViewControllerY = 0 
     pageViewControllerH = Constants.ScreenHeight 
    } else { 
     pageViewControllerY = 0 
     pageViewControllerH = Constants.ScreenHeightWithoutStatusBar 
    } 
    pageViewController.view.frame = CGRect(x: 0, y: pageViewControllerY, width: Constants.ScreenWidth, height: pageViewControllerH) 


    pageViewController.view.backgroundColor = UIColor.clearColor() 
    addChildViewController(pageViewController) 
    view.addSubview(pageViewController.view) 
    pageViewController.didMoveToParentViewController(self) 

} 

我試圖使用

for v: UIView in pageViewController.view.subviews { 
     if (v is UIScrollView) { 
      let scroll = v as! UIScrollView 
      scroll.setContentOffset(CGPointMake(0, 0), animated: false) 
      print("----") 
     } 
    } 

用於抽屜的功能我使用這個庫drawer

它表示這樣showing like this,並希望像這樣的顯示want to display like this

有一點是,如果我在屏幕上的任何地方觸摸,然後去正常

+0

只是選擇了放置pageviewcontroller的故事板和右側有一個選項UnderTopBar只需取消選擇該選項。你會得到解決方案。或者你可能只是設置約束與toplayout,以便設置從顯示以查看 –

回答

1

只是選擇了放置pageviewcontroller的故事板,右側有一個選項UnderTopBar只需取消選擇該選項。你會得到解決方案。或者你可能只是設置約束與toplayout,所以設置從顯示到查看

+0

感謝您解決它的目的...... –

相關問題