I want to fix PageViewController views in specific view. When i load into ViewController main view it's working fine, but when i load it in subView PageViewController not fixing in that subView. How to fix PageViewController in subview.
Image 1, red colour view is ,my subView I want to fix PageViewController in this red colour view.
image 2 , this is I'm getting.
Based on your code in your other question, you are adding your page view to your (red) subview but not setting its frame.
// Create the page container
pageContainer = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
pageContainer.delegate = self
pageContainer.dataSource = self
pageContainer.setViewControllers([page1], direction: UIPageViewController.NavigationDirection.forward, animated: false, completion: nil)
// Add it to the view
pageControllerView.addSubview(pageContainer.view)
// set the frame of the pageContainer view to match its superview (the red view)
pageContainer.view.frame = pageControllerView.bounds
// let it resize if needed (such as device rotation)
pageContainer.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
This should solve the issue.