简体   繁体   English

如何在iOS中将所有左右边距都设置为安全区域?

[英]How to all left and right margins to Safe Area in iOS?

I have two Stack Views that are constrained to start from a Safe Area.我有两个堆栈视图,它们被限制为从安全区域开始。

在此处输入图片说明

I want to add some space between them and the beginning of the screen.我想在它们和屏幕开头之间添加一些空间。

Instead of adding margin values to each Stack View, can I make Safe Area smaller to move all elements?我可以将安全区域缩小到移动所有元素,而不是为每个堆栈视图添加边距值吗? Or it is possible to add left padding to Safe Area?或者可以将左填充添加到安全区域?

您可以设置 UIViewController 的“additionalSafeAreaInsets”属性来设置安全区域插入。

self.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 60, 0, 0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM