简体   繁体   English

我的导航栏没有 go 到屏幕顶部 Xcode 13.0

[英]My navigation bar doesn't go to the top of the screen in Xcode 13.0

I am using a navigation controller and my navigation bar will not extend to the top of the screen.我正在使用导航 controller,我的导航栏不会延伸到屏幕顶部。 I never had an issue with this until I updated Xcode to version 13.0.在我将 Xcode 更新到版本 13.0 之前,我从来没有遇到过这个问题。 I am using storyboard and can't figure out why this issue is happening.我正在使用 storyboard 并且无法弄清楚为什么会发生此问题。 (See photo) (见照片)

故事板的屏幕截图

If you are looking for how to make it with storyboards, simply turn on "Scroll Edge" in the attributes inspector, while you tap on the Navigation bar... image here如果您正在寻找如何使用故事板制作它,只需在属性检查器中打开“滚动边缘”,同时点击导航栏...图像在这里

If you are not using storyboards, try setting a delegate object for the navigation bar.如果您不使用故事板,请尝试为导航栏设置委托 object。

navigationBar.delegate = self

Conform UIBarPositioningDelegate in your delegate object and attach bar to the top在您的委托 object 中符合 UIBarPositioningDelegate 并将栏附加到顶部

ViewController: UIViewController, UIBarPositioningDelegate {
func position(for bar: UIBarPositioning) -> UIBarPosition {
    return .topAttached
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 tabView 中将导航栏固定到 go 到屏幕顶部? - How can I fix the navigation bar to go to the top of the screen in a tabView? 顶部导航栏没有出现 - Top navigation bar doesn't appear “if (@available(iOS 13.0, *))” 在 Xcode 10.3 中无法编译 - “if (@available(iOS 13.0, *))” doesn't compile in Xcode 10.3 Xcode 6:导航栏不显示真实颜色 - Xcode 6: Navigation bar doesn't show real color 使用相机时将导航导航导航.navigate 不 go 反应到下一个屏幕 - React navigation navigation.navigate doesn't go to next screen while using camera 为什么我的导航栏在滑动时没有隐藏? - Why doesn't my navigation bar hide on swipe? iOS 11隐藏状态栏将我的导航控制器拉到屏幕顶部 - iOS 11 Hiding Status Bar pulls my Navigation Controller to the top of the screen 向导航栏添加渐变将隐藏 iOS 13.0 + 中的栏按钮项目 - Adding Gradient to the navigation bar will hide bar buttons items in iOS 13.0 + 我已经隐藏了导航栏和状态栏,现在屏幕边缘平移手势回去都行不通,这是典型的吗? - I've hidden the navigation bar and the status bar, now the screen edge pan gesture to go back won't work, is this typical? 在导航栏顶部绘制我的视图 - Drawing my view on top of navigation bar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM