Ask Your Question
2

When subviews are enclosed in NavigationView, why do they shift upwards and downwards in SwiftUI?

asked 2023-06-18 00:55:36 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-18 01:07:01 +0000

lalupa gravatar image

Subviews in NavigationView shift upwards and downwards because the NavigationView adds a navigation bar at the top which changes the layout of the subviews. The navigation bar takes up additional space, and SwiftUI automatically adjusts the layout to account for it. Additionally, when you scroll down in a view that has a navigation bar, the navigation bar will hide, causing the content to shift upwards to fill the empty space.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-18 00:55:36 +0000

Seen: 12 times

Last updated: Jun 18 '23