Reputation: 246
I am trying to assign frames of UIPageController's child views. I have created a view on the storyboard, assigned a constraints, made an outlet. But in the application it acts weird.
self.pageviewcontroller.view.frame = self.viewForPageContent.frame
self.addChildViewController(pageviewcontroller)
self.view.addSubview(pageviewcontroller.view)
self.pageviewcontroller.didMove(toParentViewController: self)
red rectangle is viewForPageContent:
and results are the following, on my iphone 5s it gets incredibly weird:
///but on the 7 simulator it gives correctly placed view, but with dots. What could be the issue?
Upvotes: 2
Views: 474
Reputation: 246
eventually I did not find the proper solution, but my workaround is the following peace of code, in case anyone else meets the problem:
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)! )
Upvotes: 1