skip to Main Content

I Ran into a problem – I can’t attach text to the bottom of the screen – Text("Общи условия и поверителност")- when the screen is expanded a little, the object is at the bottom, but it doesn’t change its location on large screens. I tried using Stack { space() item } but then the object just goes out of the screen’s field of view. What am I doing wrong?

P.S. Text("Общи условия и поверителност")

iphoneSE:

enter image description here

iphone11:
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Try to position the screen with .position(x: UIScreen.main.bounds.size.height)

    You can use this extension for cleaner code -

    extension UIScreen { static let screenWidth = UIScreen.main.bounds.size.width static let screenHeight = UIScreen.main.bounds.size.height static let screenSize = UIScreen.main.bounds.size } If you want to be more accurate you can GeometryReader like so -

    GeometryReader { geo in Text("Общи условия и поверителност") .potision(x: UIScreen.screenHeight - geo.safeAreaInsets.top) } This will also includes the safeArea in the calculations

    @AvivProfesorsky - enter image description here

    The object has disappeared, but you can still click on it and go to another screen o_O


  2. Try to position the screen with .position(x: UIScreen.main.bounds.size.height)

    You can use this extension for cleaner code –

    extension UIScreen {
       static let screenWidth = UIScreen.main.bounds.size.width
       static let screenHeight = UIScreen.main.bounds.size.height
       static let screenSize = UIScreen.main.bounds.size
    }
    

    If you want to be more accurate you can GeometryReader like so –

    GeometryReader { geo in 
       Text("Общи условия и поверителност")
           .potision(x: UIScreen.screenHeight - geo.safeAreaInsets.top)
    }
    

    This will also includes the safeArea in the calculations

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search