TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: How to set text position for all screen sizes in SwiftUI?

Forums > SwiftUI

Hi everyone, I'm working on a measurements app, and I would like to set measuring in the object, looking at the image.

https://ibb.co/qdHgGp6

That screenshot from iPhone 14 pro max, but when I run the app in iPhone 14 pro, the view is very bad. How can I solve that issue? My code:

ZStack {
    GeometryReader { geo in
        Image("test3")
            .resizable()
            .scaledToFit()
            .frame(maxWidth: geo.size.width * 1)
            .padding()

        HStack(spacing: 40) {

            Text(Joint.formatted())
                .position(x: geo.size.width - 383, y: geo.size.height - 350)

            Text(W1.formatted())
                .position(x: geo.size.width - 405, y: geo.size.height - 350)

            Text(L1.formatted())
                .position(x: geo.size.width - 382, y: geo.size.height - 350)

            Text(W2.formatted())
                .position(x: geo.size.width - 365, y: geo.size.height - 350)

            Text(L2.formatted())
                .position(x: geo.size.width - 350, y: geo.size.height - 350)

        }
    }
}

thanks in advance

3      

I got the solution

https://stackoverflow.com

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.