Ethan Brimhall
Ethan Brimhall

Reputation: 376

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. I never had an issue with this until I updated Xcode to version 13.0. I am using storyboard and can't figure out why this issue is happening. (See photo)

screenshot of storyboard

Upvotes: 1

Views: 1382

Answers (1)

DmitryKhm
DmitryKhm

Reputation: 25

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.

navigationBar.delegate = self

Conform UIBarPositioningDelegate in your delegate object and attach bar to the top

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

Upvotes: 1

Related Questions