共享扩展中的 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 }

它导致所应用的容器永远不会改变其宽度和高度,从而导致效果,因此在将设备方向从纵向更改为陆地空间时,使容器看起来很糟糕。

最新更新