用于在顶部创建自定义导航栏的 UIView 在 iphone x 的顶部留下 space

UIView used to create custom navigation bar at top leaves space at top in iphone x

I have used one uiview to create custom navigation bar in my application.I have given leading and trailing constraints zero and heigh 84,and top space to superview = 20.This looks fine in other devices but in iphone x it leaves space at top.Please see attached screenshot. How to resolve this?

使用本文对自定义导航栏进行了更改:https://medium.com/@kahseng.lee123/creating-custom-navigation-bar-tab-bar-for-iphone-x-f03b1e1827d3

我添加了一个额外的背景视图,并为其超级视图设置了前导、尾随和顶部约束为零,并将底部与自定义导航对齐 view.And 导航视图的高度约束更改为 44,前导尾随并且关于安全区域的最高约束为零。这解决了问题。