iOS Development

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

Spread the love

I am engaged on an iOS app the place I intention to increase my content material to fill all the display screen, attaining an edge-to-edge full-screen impact just like what occurs routinely with UITableViewController.

enter image description here

My present setup includes a UICollectionView embedded inside a UIPageViewController. To attempt 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)

This is the end result

enter image description here

Nevertheless, this did not prolong 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 motive) 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 problem the place the underside content material of the UICollectionView is simply 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 routinely, making certain that content material would not overlap with the gadget’s backside edge or residence indicator. That is mentioned in

I am in search of a approach to obtain an identical computerized adjustment with my UICollectionView setup.

Does anybody have ideas on how one can correctly obtain this edge-to-edge impact whereas making certain the content material just isn’t uncomfortably near the display screen edges? Particularly, I am questioning if there is a approach to routinely modify the content material inset or if there’s a greater strategy to constraining the UIPageViewController for a full-screen impact.

Thanks upfront in your assist!

Leave a Reply

Your email address will not be published. Required fields are marked *