Back arrow Xcode

Can someone teach me how to add a back arrow to my Xcode project. I looked on YouTube and all the tutorials have navigation controllers and the storyboards have their own back button without even them adding anything. But that doesn’t happen to me

Hi @XcodeUser9

Choose Editor > Embed In > Navigation Controller

Then connect (control drag to the new ViewController) a button to present the new ViewController and a < Back button is automatically added.

If this what you are looking for?

Blessings,
—Mark

thank you FoundationSW (Mark)

I already have 2 view controllers 3 in total 1 is a navigation controller

The back button is covering a paddle in my game. Is there a way to move it

Hi,

Sure, you can add a button anywhere on the ViewController that makes sense and then control-drag back to the originating ViewController or dismiss the VC in code.

To hide the xcode generated button, try this (I assume Swift)

self.navigationItem.hidesBackButton = true

Blessings,
—Mark

Maybe you can make your main ui smaller (to acommodate a space for the back button)… you can do it easily but putting everything inside a uiview and have it below the backbutton area

My problem is on of my paddles is at the top and the back button is blocking from viewers to see the paddle. So how do I move the back button

did you try moving the back button like mark suggested?

can you also show this “paddle” via a screenshot so we know what it looks like

yes but nothing happened. paddle is the little bar thing. Can you give me code to make my own back button. And where do I type it? GameScene.swift or Gameviewcontroller.swift. And where do I connect my button.

Can someone please help me

Hi @XcodeUser9

You will want to connect the @IBOutlet to the current view with your paddle that is causing the problem. Remember, the order you place it in the Storyboard is important. Once you add it, if you can not see your new button, check to be sure the black background view is not covering it.

You can control drag the new button to the originating UIViewController or dismiss it with code.

Alternatively, you can do what Francis suggested and change the constraints on the background view to safe areas and the default back button will show up in the menu bar.

Let me know of that does not help.
Blessings,
—Mark

Thank you so much it helped.