Is there a quick way to jump to an action associated with a control.
Say there is a button on a XIB file that has an associated action. The way to find the code associated with this is rather tedious. Is there a short cut that can quickly jump to the code.
I am spoiled by Visual Studio - double click on a button and it takes you to it's handler
Jump to Line ( ⌘ + L )
Searching for text in Xcode is quite easy. Type Command-Shift-F and off you go.
In Xcode 4 preferences, it's configured to be ^ + ⌘ + ← (control-command-left arrow) to navigate back and ^ + ⌘ + → (control-command-right arrow) to navigate forwards.
Hold down the Control key and drag (or right-click-and-drag) from the control in question over into your class @interface . Let the mouse button go when Xcode indicates a successful drag with a horizontal line. In the window that pops up, choose whether you want to create an outlet or an action.
The fastest way I know to at least get quickly to the source file in which the action resides is the following:
Once you are in the class, the action should be easy to find. If that's not the case, because your source file is so big, type ctrl+6 to open the “Document Items” drop down and start typing the name of the action. Once you see the action, select it via keyboard or mouse.
If you often don't know the name of the action, you will have to look it up before navigating to the class, e.g. by right clicking on the button.
I would advise to use ^
+⎇
+⌘
+Enter
to get to referenced code file. There you can search for @IBAction
s or @Outlet
s. If a UIButton
has a segue attached, this method won't help to find it.
To review a list of actions, segues and outlets you can select an object on the storyboard and press ⎇
+⌘
+7
to open Connections Inspector on the right pane.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With