ios - 共享扩展中的 UIHostingController 不会调整其根视图的大小
问题描述
我在共享扩展中使用了 swiftUI,使用 UIHostingController。当用户在共享扩展打开时更改设备方向时,UIHostingController rootView 不会改变它的宽度
解决方案
所以实际的问题是这个函数
func roundCorners(corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
layer.mask = mask
}
它导致它所应用的容器永远不会改变它的宽度和高度,从而导致效果,从而使容器在将设备方向从纵向更改为陆地空间时看起来很糟糕
推荐阅读
- php - 根据顶层(共享值)合并第二级数组
- qt - 设置 QMenu::indicator:exclusive:checked 样式表会导致未选中项目出现不良行为
- ios - UITextField textContentType 不返回建议
- wms - 如何在 ArcGIS WMS 中启用 layerDefs?
- c# - 如何在 DevOps 中为端点使用文件转换
- javascript - 将 Node.js 连接到 Notepad++ 控制台
- java - 如何在 ImmutableMap 中扁平化 ImmutableList
- geode - 我可以更改 PR 上简单选择查询的结果块大小吗
- python - 我的自定义交叉熵损失函数有什么问题?
- jenkins - 在 slack 上显示测试报告