nativescript - 在 Nativescript 中获取 iOS 安全区域的宽度/高度
问题描述
我正在尝试在 Nativescript 中获取 iOS 安全区域的宽度和高度。我找不到有关如何完成此操作的任何文档。
有人可以帮我吗?
解决方案
我已经找到了解决方案。我希望这对某人有所帮助。
import * as application from "@nativescript/core/application";
import { Screen } from "@nativescript/core/platform";
let screenheight = Screen.mainScreen.heightDIPs;
let safeAreaTopInset = application.ios.window.safeAreaInsets.top;
let safeAreaBottomInset = application.ios.window.safeAreaInsets.bottom;
let safeAreaHeight = screenheight - safeAreaTopInset - safeAreaBottomInset;
推荐阅读
- regex - PhpStorm Ideolog 正则表达式
- c# - 如何在 Xamarin Forms 中使用 Datawedge 启用/禁用条形码扫描仪
- python - 为什么 A[:,i] 与 A[:][i] 不同?
- mysql - 不使用 first() 的 Spark SQL vs Normal SQL 查询错误
- r - 在 R 中,如何将一列拆分为两列?谢谢
- python - 根据属性的值在 Django 项目中使用信号删除通知
- python - 可以使用元组索引找到列表的长度吗?
- javascript - 如何在上传到数据库之前拖动和重新定位图像?
- node.js - nginx.conf文件中的nginx配置问题
- sql - 如何查看每个员工在哪个类别中销售的商品最多?我只能显示员工的姓名和销售的商品