Chrisicut
Chrisicut

Reputation: 357

Xcode how do I duplicate a View Controller? I've had this complication for days

How do I duplicate View Controllers, so I don't have to re-place the menu screen in my UI, because it stays constant throughout each screen.

Somebody told me to copy this: example

However 'View Controller Scene' is not in my project navigator...

enter image description here

So they told me: "You have to right click in your project navigator and create a new file. Select "Cocoa Touch Class" and create a subclass of UIViewController."

I did exactly that, but it gives me code files, not a 'View Controller Scene' in which I can copy the 'View Controller' in order to have two of the same on my storyboard.

I am using Objective C, and I have had this problem for days, can somebody PLEASE help me out?

Upvotes: 0

Views: 5215

Answers (1)

MoMo
MoMo

Reputation: 499

In your first photo, where you have the "View Controller" highlighted, click on the left arrow to open the view hierarchy. Select the view that comprises your menu and hit Command + D or Edit > Duplicate.

This will create a duplicate version of your menu in the same ViewController. Grab the duplicated copy and move it to any other scene you want in your Storyboard

EDIT: You're looking at the wrong menu. Click on your Main.storyboard and then in the bottom Left of the Storyboard, click the little menu icon that opens the Document Outline. Alternatively, go to Editor > Show Document Outline when Main.storyboard is selected

Upvotes: 3

Related Questions