Melvin Roest
Melvin Roest

Reputation: 1492

xcode 4.2 ios 5 copying contents of a storyboard

Original Question:

This is my first post ever. I'm trying to learn ios programming by following cs193p (online). I got stuck on assignment 3 with a very (seemingly) simple thing. I did a few google searches on it already.

I don't know how to copy my view from assignment 2 (which is a storyboard) to my new xcode project.

I created a new master detail application (called it Calculator3), copied the storyboard from assignment 2 (Calculator2) in there as well. However, it's not possible for me to get the contents of that storyboard and put them in the new generated storyboard.

So is it possible to copy the contents of one storyboard into another? If not, then how do I do this?

Upvotes: 9

Views: 8505

Answers (3)

The Camster
The Camster

Reputation: 1929

You can copy a storyboard to another project by drag and dropping the story board. Make sure to tick the box "Copy items into destination groups folder".

Of course all of your references will break and have to be rebuild, but the layout and segues will all be there.

Upvotes: 0

csonuryilmaz
csonuryilmaz

Reputation: 1735

Bringing the old storyboard from source project into your new target project as a temp storyboard works. :)

(I've found it in en.lproj folder from source project) Also you can copy & paste all view controller component by selecting gray bar under your view.

Then remove temp storyboard and continue with pasted one.

Upvotes: 2

Melvin Roest
Melvin Roest

Reputation: 1492

Thanks to LU RD I post my answer here, instead of using an edit in my first post.

Answer:

A friend of mine solved it. The reason why I got this wrong the whole time was because I did cmd/apple A + cmd/apple C. Instead of clicking at the top of the view I wanted to copy and then do cmd/apple C. After that, paste it with cmd/apple V in the storyboard you want to.

I noticed it only really works in the following situation (I thought it worked in more situations).

  1. The two files should be in the same project, so copy the old storyboard file to your new project.
  2. Then display the two storyboards next to each other via the "show the assistant editor" button.
  3. Click in the top middle of your view and copy via cmd/apple C.
  4. Click on your other storyboard and paste it via cmd/Apple V.

Upvotes: 22

Related Questions