Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在尝试使用 XCode12 和 Swift 制作应用程序,但默认导航栏高度太高。我似乎找不到关于如何更改导航栏高度的 XCode12 的任何内容,而且我对 iOS 应用程序开发非常陌生。
有谁知道如何以编程方式更改 XCode12 上导航栏的高度?
请告诉我!
我也有导航栏的问题。我假设你问这个问题是因为你的元素被导航栏覆盖,或者没有足够的空间来添加你想要的所有东西,而 UI 不会被塞满,所以这里有两种解决方法:
导航栏可能会覆盖元素,因为您使用了edgesIgnoringSafeArea(.all)修饰符。您可以删除或更改此修饰符,并且元素不会在导航栏下方滑动(例如:).edgesIgnoringSafeArea(.bottom)。
edgesIgnoringSafeArea(.all)
.edgesIgnoringSafeArea(.bottom)
您可以使用UIScreen.main.bounds.(height or width) 以编程方式调整元素的大小。
UIScreen.main.bounds