iOS App layout is wrong with calling status bar

懵懂的女人 提交于 2019-12-09 18:38:50

问题


Faced with an issue with status bar during active call and application layout.

I'm using autolayouts. When I run the app, and then start a call, all works fine, the UI is scaled properly with changed status bar.

But if I first start a call and then run the app, application screens moved for 20pt to the bottom, like if they did not react on new status bar. And even if I will turn off the call, the UI will be moved to bottom.

Maybe somebody know how o fix that?


回答1:


This is easy, when you gave the constraints to your views you gave them with respect to the TLG(Top Layout Guide) of your View Controller. Now when a call occurs the status bar resizes due to which the TLG changes and resulting of which the views move.

To prevent this you might wanna give the top constraint of your view with respect to the Top of the superview. Now in this case views's constraints are not dependent on TLG which changes on change of status bar size, therefore they do not change during a call or any other event which change the size of the status bar.



来源:https://stackoverflow.com/questions/43858569/ios-app-layout-is-wrong-with-calling-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!