2021年5月1日星期六

How to make custom navigation bar background color to go beyond safe area in SwiftUI

I implemented a custom navigation bar which is simply a view with a title text and an arrow to dismiss the view. I want only the background color of the nav bar to go beyond the top safe area whilst the content respects the safe area constraints

this is the code for the view:

var body: some View {          ZStack {              VStack {                  CustomNavigationBar(title: "Sample Title")                  Spacer()              }          }      }  

Below I have attached a screenshot of current view:

navigation bar view

https://stackoverflow.com/questions/67352628/how-to-make-custom-navigation-bar-background-color-to-go-beyond-safe-area-in-swi May 02, 2021 at 11:04AM

没有评论:

发表评论