因此,iPhone 11 Pro Max上的safeAreaInset.bottom是34.0,但是当键盘打开时,它将safeAreaInset.bottom更改为键盘的高度(346.0点)。打开键盘后,有什么方法可以访问safeAreaInset.bottom值(34.0)?
作为参考,我的内容视图中包含一个几何读取器:
var body: some View {
GeometryReader { proxy in
//I pass in proxy into views in here and then access the safe area with proxy.safeAreaInsets.bottom
}
}
我还需要它能够在所有设备上适应,并且似乎为不同设备编写一堆if语句是一个非常糟糕的解决方案。有人有建议吗?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句