I need to overlay a UIView over a UIPageViewController and was hoping it would let me turn off the clipsToBounds and then resize the interactive bounds area to a smaller height and place another view on top of the non-interactive/non-clipped region.
Unfortunately the UIPageViewController resizes the childViewController in some way where it will clip it no matter what.
What I want is something like this:
How can I achieve this? I can find no samples of doing anything like this and did try to use the UICollectionViewController instead with paging but it doesn't have the smooth gaps between pages like the UIPageViewController does.
The following works for me in Swift:
pageViewController.clipsToBounds = false
pageViewController.view.clipsToBounds = false
for view in pageViewController.view.subviews {
view.clipsToBounds = false
}
Similar to Vitaly's answer, but uses a loop to ensure that all subviews are taken care of.
View of UIPageViewController has another UIView (more precisely _UIQueuingScrollView) in the subviews hierarchy before actual view of your childViewController. So, to disable clipsToBounds you should do something like that:
UIPageViewController *pageViewController = ...;
pageViewController.view.clipsToBounds = NO;
[[pageViewController.view subviews].firstObject setClipsToBounds:NO];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With