Dmytrii G.
Dmytrii G.

Reputation: 547

How handle the UIPageViewController VCs rotating by viewWillTransitionToSize func?

I try to create UIPageVC with 3 pages. All is good, but when I rotate device and after this change page I will see that rotates only page, which is settled in PageVC in rotate moment.

How rotate other 2 VCs, when I rotate any page?

Maybe I can do this in PageVC class?

I used Swift 4.0, so I must use viewWillTransitionToSize func.

Thanks for all answers!

Upvotes: 0

Views: 301

Answers (1)

Eric Armstrong
Eric Armstrong

Reputation: 666

You could try overriding the viewWillTransitionToSize function and forward the message to all of your view controllers contained in your UIPageViewController.

fileprivate var yourViewControllers = [UIViewController]()    

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)

    yourViewControllers.forEach({ $0.viewWillTransition(to: size, with: coordinator) })
}

Upvotes: 1

Related Questions