Xcode 5 - Paste in place/master page/header? - ios

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 :)

Related

How to select multi controllers in storyboard?

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.

Selecting all outlets on xcode ios 8

I was just wondering how I can select all outlets on xcode ios 8. Some of my labels are on top of each other, so I cant select them.
Thanks
Probably the most useful secret trick in Xcode's nib editor is to Shift-Control-click on an interface item in the canvas. This gives a menu where you can select that interface item or anything behind it.
If I understand you correctly, you are trying to select some elements but because they are overlapping you can't get to them.
Click on the box with a line in it as show in the illustration and it will show all your elements and you can select it from their. In previous Xcode versions it was an arrow instead of a line.
Thank you #matt for pointing out, that is called the Document Outline.

How to create a new view (tab) in jenkins programatically

I am trying to create a new view on jenkins( using the plus symbol). Manually , you click the plus symbol enter values in 2-3 text boxes and a view gets created but I would like to do
it using a program. Can anybody suggest me a way to go about it?
Finally found a way using a rubygem named jenkins_api_client ( http://rubygems.org/gems/jenkins_api_client)

Can I copy a storyboard from one project to another project?

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.

Change the listing order of the view controllers in Xcode storyboard

I'm just starting my first application using storyboards. I'm using Xcode 4.5 and iOS 6 SDK. I want to know how to change the order in which the controllers are listed in the Document Outline (panel to the left of the storyboard).
In Latest Xcode 13 you can manually reorder storyboard scenes. Just drag&drop in the left pane.
Old answer
In Xcode 11 you just open storyboard XML and move specific "scene" to proper place under "scenes" tag. And that's it. The order will correspond to Document outline.
In Xcode 5, the order of the view controllers/scenes listed in the storyboard's "Document Outline" seems to be determined by an alphanumeric sorting of the sceneID attribute values in the storyboard XML file.
After upgrading to Xcode 5 from 4.6 the Document Outline seemed to list my scenes in a random order. I inspected the Storyboard XML file (right click on storyboard file -> Open As -> Source Code) but the order of the scenes was correct. After further investigation I realized the sceneID attribute values were the issue. I found each sceneID attribute and added an alphanumerically increasing prefix to the value. For example, for the first scene that should appear in the Document Outline I prefixed its sceneID value with a "1a", for the second "1b", for the third "1c" and so on. After doing that for all my scenes, they had a proper listing order in the Document Outline.
I think the sceneID values are probably only used for unique identification/ordering purposes, so hopefully changing them doesn't cause other unexpected problems. But I'm still able to work with the storyboard in Interface Builder without problems and my app seems to work normally. So if this problem is irritating you as much as it did me, you might consider this workaround until Apple gives us a proper solution... just be sure to make a backup first!
In the Document Outline, drag the orange view controller icon. As you do this you will see the blue horizontal insertion point appear between the grey boxes. Let go and the whole grey group box for the view controller will relocate.
At least for Xcode 4.6 , the scenes are in the order they're stored in the storyboard xml.
So you can open it with a text editor and reorder the tags to you liking, and start Xcode.
I am not sure if it is still meaningfull for you.
As of xcode 6.1 you can rightclick your storyboard file, choose "Open as..." -> "Source code" and change the order of view controllers rearranging sections order. I can't move them by drag'n'dropping view controller icons for unknown reason, so it is the only way that works for me.
For Xcode 5.1.1, you have to change the order of tag segue. Open the storyboard as source code (Right Click -> Open As -> Source code)
<segue destination="Bdn-Z8-Ql8" kind="relationship" relationship="viewControllers" id="0DS-1d-02F"/>
<segue destination="KY3-Z9-s1u" kind="relationship" relationship="viewControllers" id="u45-Ly-JkB"/>
<segue destination="k72-nP-MyV" kind="relationship" relationship="viewControllers" id="TAj-be-l8p"/>
<segue destination="gcA-x5-8Iw" kind="relationship" relationship="viewControllers" id="B7T-js-1Vs"/>
Changing the order of the above lines will change order of ViewControllers
It seems that the view controllers belong to the tab bar controller, so the order of the buttons determine the order not the position of the view controllers on the screen. You should be able to drag and drop the buttons.
Just Drag and Drop the icon on the bottom in your first View Controller Screen. Xcode 11.6

Resources