Posts

Post marked as solved
6 Replies
3.1k Views
Hi,I am completely new to iOS development and I'm trying to follow the official tutorial.It is a bit annoying because it doesn't seem to be up to date, but I managed to get up to this point: https://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/BuildABasicUI.html#//apple_ref/doc/uid/TP40015214-CH5-SW1It is a very simple app with a label, a text field and a button placed vertically in a single stack view.I am trying to set up the stack view margins so that it takes the safe area into account while also not sticking to the edge of the screen.What I've done is set constraint so that the top, left and right edge of the stack view stick to the edge of the safe area.I partially get what I want:- in portrait, the top of the layout is properly placed but the sides stick to the edge of the screen- in landscape, the sides of the layout are properly placed but the top of the layout sticks to the top of the screenI could add a margin of 20 in trailing/leading to make it work while in portrait, but it won't look nice to have those margins when in portrait. Also, it feels like default margins should be defined at the app level and not on every single view ?I can't believe I'm stuck on such a simple problem, but could anyone tell me what is the recommended way to set up margins when making a new iOS app ?Thanks
Posted
by Saturnyn.
Last updated
.