HomeiOS Developmentios - Reaching Edge-to-Edge Full Display screen Impact with UICollectionView in UIPageViewController

ios – Reaching Edge-to-Edge Full Display screen Impact with UICollectionView in UIPageViewController


I am engaged on an iOS app the place I purpose to increase my content material to fill your complete display screen, reaching an edge-to-edge full-screen impact much like what occurs robotically with UITableViewController.

enter image description here

My present setup entails a UICollectionView embedded inside a UIPageViewController. To try to obtain the full-screen impact, I initially set the UIPageViewController’s backside constraint to match the safeAreaLayoutGuide’s backside anchor:

pageViewController.view.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)

Here is the result

enter image description here

Nonetheless, this did not lengthen the content material to the underside fringe of the display screen. I modified the constraint to anchor to the view’s backside (with an added fixed for some cause) as follows:

pageViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, fixed: 32)  // Having 32 sounds unusual. Is there a greater means?

enter image description here

This modification appears to attain the specified edge-to-edge impact, however now I am going through a difficulty the place the underside content material of the UICollectionView is just too near the sting of the gadget, particularly when scrolled to the very backside.

enter image description here

In UITableViewController, such padding or content material inset changes appear to be dealt with robotically, guaranteeing that content material does not overlap with the gadget’s backside edge or dwelling indicator. That is mentioned in https://sarunw.com/posts/how-to-ignore-safe-area-insets-in-uikit/

I am on the lookout for a technique to obtain an identical computerized adjustment with my UICollectionView setup.

Does anybody have ideas on easy methods to correctly obtain this edge-to-edge impact whereas guaranteeing the content material will not be uncomfortably near the display screen edges? Particularly, I am questioning if there is a technique to robotically alter the content material inset or if there’s a greater method to constraining the UIPageViewController for a full-screen impact.

Thanks prematurely to your assist!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments