I currently have my layout design setup as a fullscreen scrollview on one view controller in which I add other view controllers as sub views to create a paged effect. On normal iphone screens it works beautifully. However when running on iPhone X, things seem to appear off centered, and I can page in multiple times in one page.
Here is my code for setup of the scrollview
self.scrollView.contentSize = CGSize(width: self.view.frame.width, height: self.view.frame.size.height * 3)
if #available(iOS 11.0, *) {
self.scrollView.contentInsetAdjustmentBehavior = .never
} else {
// Fallback on earlier versions
}
let V1 = self.storyboard?.instantiateViewController(withIdentifier: "S1") as! UINavigationController!
self.addChildViewController(V1!)
self.scrollView.addSubview(V1!.view)
V1?.didMove(toParentViewController: self)
V1?.view.frame = scrollView.bounds
myViewsArray.append(V1!)
let V2 = self.storyboard?.instantiateViewController(withIdentifier: "S2") as UIViewController!
self.addChildViewController(V2!)
self.scrollView.addSubview(V2!.view)
V2?.didMove(toParentViewController: self)
V2?.view.frame = scrollView.bounds
myViewsArray.append(V2!)
var V1Frame: CGRect = V1!.view.frame
V1Frame.origin.y = 2*self.view.frame.height
V1?.view.frame = V1Frame
var V2Frame: CGRect = V2!.view.frame
V2Frame.origin.y = (self.view.frame.height)
V2?.view.frame = V2Frame
V2!.view.alpha = 1
I have safe area on in story board.