2017-02-01 2 views
2

UIPageControllerの子ビューのフレームを割り当てようとしています。 私はストーリーボード上にビューを作成し、制約を割り当ててコンセントを作りました。しかし、アプリケーションでそれは変な動作をします。UIPageViewControllerのビューのフレームは、iOSでは予測できません。

self.pageviewcontroller.view.frame = self.viewForPageContent.frame 
    self.addChildViewController(pageviewcontroller) 
    self.view.addSubview(pageviewcontroller.view) 
    self.pageviewcontroller.didMove(toParentViewController: self) 

赤い長方形はviewForPageContentです:

enter image description here

、それは信じられないほど奇妙な取得5Sの結果は、私のiPhone上で、次のとおりです。

enter image description here

///が、上7シミュレータは、正確に配置されたビューを与えるが、ドットを付ける。何が問題なの?

答えて

1

結局、私は適切な解決策を見つけることができませんでしたが、誰が問題を満たしている場合には、私の回避策は、次のコードの平和です:

self.pageviewcontroller.view.frame = 
     CGRect(x: 0, 
       y: UIApplication.shared.statusBarFrame.height 
       + (self.navigationController?.navigationBar.frame.height)! 
       width: self.view.frame.size.width, 
       height: self.view.frame.size.height 
       - (self.navigationController?.toolbar.frame.height)! 
       - (self.tabBarController?.tabBar.frame.height)!) 
関連する問題