Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set bottom safe area to XIB in iOS?

I want to open custom popup view(designed in XIB) which is displaying from bottom but rightnow in iPhoneX simulator, it displayed from bottom of the screen. i want to open popup in safe area.

Result in iPhone-X

enter image description here

And XIB Layout with constraints.

enter image description here

like image 547
SmarterSusheel Avatar asked Dec 13 '22 20:12

SmarterSusheel


1 Answers

Solution in simple words: Remove bottom constraint with superview and attach it (bottom constraint) with bottom (anchor) layout constraint of 'Safe Area'

Follow these steps to find solution:

  1. Enable 'Safe Area Layout', if not enabled.
  2. Remove 'Bottom constraint' if it shows you connection with with Super view and re-attach with safe layout bottom anchor. OR Double click on bottom constraint and edit from super view to SafeArea bottom anchor

Look at this snapshot:

enter image description here

Here is result:

enter image description here


Update:
Here is same result with XIB also. I don't see any problem with XIB here.

enter image description here

like image 129
Krunal Avatar answered Dec 26 '22 19:12

Krunal