To reuse a storyboard, could I simply copy it from one project to another project (then make modification to the storyboard as required)?
Yes you can, just make sure they are selected as your main storyboards as per image below.
As #Muhammad said you can and it is very simple!
You just have to drag the Storyboard file from one project to another and select all options (The same procedure as importing anything else!).
Next, you just need to go to your project options by clicking on the project icon in the left upper side of project navigator.
Then you just need to select this storyboard to be your storyboard and that's it.
Method 1
Select the View Controller in the storyboard and press Command + C to copy. Then press Command + V to paste in the second storyboard. Check the document outline to see where it was pasted to.
Method 2
Right click the storyboard file in the Project Navigator and select Open As > Source Code. Scroll down the XML code until you find your View Controller. It will look something like this:
<!--My View Controller-->
<scene sceneID="tne-QT-ifu">
...
</scene>
Copy this and paste it in the second project's storyboard file.
Notes
You must also copy over the view controller swift file, of course, but the outlets shouldn't need to be reconnected.
It's simple. Just follow these steps:
Press cmd + D while selecting your desired storyboard scene. It will create a duplicate copy of your selected scene.
Press cmd + x to cut the scene from the existing project.
Press cmd + v into the storyboard section of the second project.
Cheers.
Related
I recently updated my Xcode 9 to Xcode 10.1. At the right bottom of the inspector pane for storyboard, the searchbox that always used to be there for finding controls such as ViewController, UIImageView, UITextfield etc. and dragging them to the storyboard is missing. I can't find it anywhere in the menu structure.
Does anyone know how to get it to display?
It goes top right, left to the Show Standard Editor button.
you can access it with shift + cmd + L too.
Don't forget to select a xib or storyboard file first.
And it name is Library by the way.
Here is my storyboard:
and I know it looks crazy , so I plan to use storyboard reference to move the right part of the storyboard in to a new storyboard. and I googled ,it says press the shift can multi selected controllers ,but it dose not work.
so how can I move multi controllers at same time?
I have tried to use mouse ,but it only selected 5 controllers in the upper part 。
But I want to select all of them.
Just select them by dragging mouse:
And then press key Command + C to copy them,
then open the second Storyboard, press key Command + V to paste them.
Yes, it is possible.
Select controllers you want to copy
Press Command + C
Open your second storyboard file
Press Command + V
It is very easy no any key is required just select using mouse
i post the gif..
Hold down Option and scroll mouse wheel until minimum resolution, 6.25%
Click and Drag to select all view controllers - or ones you want to copy.
Click Edit->Copy or Use Ctrl+C
Go to Target Storyboard. Click Edit->Paste or Ctrl+V.
I tested this with about 40 controllers,looks like you have around that much. Old question, but new answer! :). In case anyone still looking.
Also I key-bind Option+Z to "Zoom to Fit" and this centers and displays all controllers with the Interface Builder canvas.
I'm very new to Xcode (2 days) and so far I'm finding it fairly frustrating. I'm just trying to add an image to my app's ViewController via he Storyboard, but it does not appear on the simulator. Could someone assist me?
if you are trying an example project of XCode, you may find a "Images.xcassets" folder in project. Drag your image into this folder.
then go to storyboard, focus on your "Image View".
in the attributes list, "Image" field, you can choose the image in it's drop-down menu.
the try running in simulator
good luck!
Here are some details on xcode 10.
Edit the story board, create an image view. Wayne stated, add the image you want in the Images.xcassets.
Click on your image view:
Do View -> Inspectors -> Show Attribute Inspector
Select the image:
After loading your image in the " Assets.xcassets" folder you will need to find the "Attributes inspector" under your right side inspectors tab. Focus or click on your "Image view" that you have to place as a holder on the storyboard. On the right tab under the attributes inspector (looks like a down arrow next to the ruler) you can select your image from the drop-down selection. You may also want to change Content mode to Aspect Fit while you are there.
I am working on project X. I needed to add component Y to the project. So I go and create component Y as a separate project, say Project W. Now I need to copy Project W into Project X as component Y. How do I do that? I don't mind copying one piece at a time such as: copy ViewControllers in storyboard manually, and then copy the classes manually. Thanks for any help.
Go to the ViewController or storyboard object, select the top bar so you're selecting the whole thing, and then hit COMMAND + C to copy.
Then go to your other project, and open up Storyboard, and place your cursor down onto the open field, and hit COMMAND + V to paste it.
Typically you then have to zoom out on storyboard scene to see it, as for some reason it'll place it down all cattywampus. However, you'll see the files appear in your list of scenes (middle or left panel).
Is there anyway to "paste in place" in Xcode 5? I've been trying to copy a label and paste it in place as a header on all my pages. Sounds simple but I can't find a simple solution. The "paste & preserve formatting" is greyed out every time I try to use it. Is there something like a master page in Xcode where I can just setup a header?
Select the subviews you would copy.
Menu/Editor/Embed In > View
Cut/Copy/Past the view in another view or another Xib
Select the view
Menu/Editor/UnEmbed
Done :)