Reputation: 1
I opened a window using the windowgroup in visionOS. The only thing I wanted is to keep the window's width and height ratio to a constant. But the resize controls can scale really wild. How can I achieve this? Oh by the way I put a RealityView
inside the ContentView
,did this make it worse?
I tried the following:
guard let window = UIApplication.shared.windows.first else { return }
window.frame.size = CGSize(width: windowWidth, height: windowHeight)
the windowWidth and windowHeight are got from the geometryReader wrapped around contentView. but the effect is very weird, and cannot responding to further instructions.
Upvotes: -2
Views: 40
Reputation: 1
problem solved, the solution is in UIWindowScene. My bad I didn't explain the question straight. The Geometry preference can be set to .uniform, then the whole window can be resized according to the view inside.
Upvotes: 0