Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 983
Melvin Roest Avatar asked Jan 26 '12 18:01

Melvin Roest


2 Answers

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.
like image 131
Melvin Roest Avatar answered Sep 30 '22 02:09

Melvin Roest


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.

like image 38
csonuryilmaz Avatar answered Sep 30 '22 02:09

csonuryilmaz