Hidden Features of Xcode
2013-07-08 09:03
381 查看
Hidden Features of Xcode
Hidden Features
of Xcode(http://stackoverflow.com/questions/146297/hidden-features-of-xcode)
338favorite 1047 | With a huge influx of newbies to Xcode, I'm sure there are lots of Xcode tips and tricks to be shared. What are yours? objective-c xcode osx cocoa
| |||
locked by Bill
the Lizard♦ Oct
5 '11 at 13:37
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not useit as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: Help
center.
89 Answers
activeoldestvotes123next
343 | Option ⌥ Command ⌘ Up Arrow ↑ |
share | edited Feb 19 '11 at 12:16 | community wiki 8 revs, 3 users 72% Senseful |
| This is absolutely my favorite, too. I use it constantly. Also works when we are talking about cpp and h. Not just m! :) – que que Sep 30 '08 at 21:20 | ||
| It's called "option" on the Mac, not "alt". And if you want fancy symbols, it can be written ⌥⌘↑ – Brian Campbell Mar 31 '09 at 15:33 | ||
| @Brian Your right...but it also says "alt" on the key – epatel Mar 31 '09 at 18:44 | ||
| Note that in Xcode 3.2, you have to change the key bindings to restore ⌘⌥⇠/⇢ to switch-file. They changed the default to move between positions in the same file. – Peter Hosey Sep 14 '09 at 12:34 | ||
| A three finger swipe up on the touchpad is another shortcut for the same action. – Nathan Dec 30 '09 at 2:07 |
comments
158 | ⌘ Command + Double-Click on a symbol: Jump to Definition of a symbol. ⌥ Option + Double-Click on a symbol: Find Text in Documentation of a symbol. (Only works if you have they symbol's Doc Set installed.) Favorites bar is just like you have in Safari for storing - well - favorites. I often use it as a place to store shortcuts (which you can do by drag-dropping) to files I am using right now. Generally this is more useful when I'm working with a large or unfamiliar |
share | edited Apr 4 '11 at 11:46 | community wiki 7 revs, 4 users 60% schwa |
| Gasp! Show Favorites Bar, where have you been my whole life! – willc2 Jun 28 '09 at 5:14 | ||
| The favorites bar has been "replaced" in Xcode 4 with persistent tabs. – Ascendant Aug 5 '11 at 5:35 |
comments
127 | Tab ⇥ OR Control ⌃ /: Select the next auto-completion argument. |
share | edited Aug 15 '11 at 22:26 | community wiki 5 revs, 3 users 48% Senseful |
| Note that the new XCode uses Tab to move between arguments in completions. It's more fluid. – Jab Aug 17 '09 at 17:48 |
comments
119 | When you attempt to undo after saving, you will get the following prompt: |
share | edited Oct 22 '11 at 16:54 | community wiki 9 revs, 3 users 51% nevan king |
| Control-Command-double-click is just necessary because Xcode uses Command-double-click for something else other than a discontiguous word selection. In most Cocoa apps you can do discontiguous selection with the Command modifier alone. – Nicholas Riley Nov 1 '09 at 1:26 | ||
| +1 for org name Microsoft – slf Apr 21 '10 at 12:29 |
comments
99 | Command ⌘ Shift ⇧ D |
share | edited Apr 4 '11 at 12:37 | community wiki 7 revs, 3 users 62% Senseful |
| a.k.a. your cursor. – willc2 Jun 28 '09 at 5:15 | ||
| On the Mac, a "cursor" indicates your mouse position; the flashing vertical bar is the "insertion point". – Nicholas Riley Nov 1 '09 at 1:22 | ||
| @Nicholas Riley: Caret is the right word, AFAIK - our mac developers always called it that when I worked in a software company – Flubba May 9 '10 at 19:17 | ||
| @Flubba: Caret is certainly used for this, I don't dispute it at all; it's just not the common user- or developer-centric term on Macs. If you Google for "caret site:developer.apple.com" you'll just find hits in TrueType documentation and in a single, very recently written, iPad document. – Nicholas Riley May 9 '10 at 21:32 |
comments
79 | You can use: |
share | edited Jun 22 '10 at 19:50 | community wiki 2 revs, 2 users 67% Steve Streza |
| typing # p will usually trigger code completion '#pragma mark <LABEL>' for quickly adding the label part. – willc2 Jun 28 '09 at 5:22 | ||
| It also grabs # TODOstatements. Now if only it would also grab # XXX, which is commonly used in the code base I work on... – asmeurer Dec 28 '10 at 6:22 | ||
| Xcode 4 also supports "#pragma mark - Foo" which adds the mark AND a separator at the same time. – typeoneerror Aug 4 '11 at 0:07 |
77 | You should always have a breakpoint |
share | edited Aug 15 '11 at 22:25 | community wiki 6 revs, 3 users 75% Senseful |
| Great Answer! I'd give two upvotes for (3) and (4) which I didn't know before. – Nikolai Ruhe Sep 22 '09 at 7:58 |
comment
75 | Ctrl + 2: Access the popup list of methods and symbols in the current file. This is super useful because with this shortcut you can navigate through a file entirely using the keyboard. When you get to the list, start typing characters and the list will type-select to the symbol you are looking for.
| ||||||||||||||||||||
comments |
74 | If your window displays both the detail and editor view, you can zoom the editor in to expand the editor view to the full height of the window. (This |
share | edited Aug 15 '11 at 22:21 | community wiki 5 revs, 2 users 73% Senseful |
| It took me AGES to find out how to hide the tree as well - Command-Option-Shift-E. Ah, sweet relief. I'm forever indebted to the MacMacDev Glasgow group for letting me know this. – John Gallagher Oct 12 '09 at 9:01 |
67 | Get Colin Wheeler's Complete Xcode Keyboard Shortcut List (available as PDF or PNG). Print it and keep it somewhere visible (I've got it on the wall next to my screen). edit: Updated versions for Xcode 3.2 edit 2: Updated versions for Xcode 4
| |||
52 | Not much of a keyboard shortcut but the TODO comments in the source show up in the method/function dropdown at the top of the editor. So for example: // TODO: Some task that needs to be done. shows up in the drop down list of methods and functions so you can jump to it directly. Most Java IDEs show a marker for these task tags in the scrollbar, which is nicer, but this also works.
| ||||||||||||||||||||
comments |
51 | ⌘-[ and ⌘-] to indent and unindent selected text. Makes cleaning up source code much easier.
| ||||
comments |
43 | Hold Option while splitting windows to split vertically rather than horizontally.
| ||||||||
comment |
42 | Double-click on the square brackets or parentheses to obtain bracket and parentheses matching.
| |||
show 1 more comment |
36 | Control Xcode's text editor from the command line: xed> xed -x # open a new untitled document > xed -xc foo.txt # create foo.txt and open it > xed -l 2000 foo.txt # open foo.txt and go to line 2000 # set Xcode to be your EDITOR for command line tools # e.g. for subversion commit > echo 'export EDITOR="xed -wcx"' >> ~/.profile > man xed # there's a man page, too
| |||
show 2 more comments |
31 | "Ctrl+Left/Right Arrow" to do intra-word text navigation. I use this feature to jump the cursor from the one "camel hump" in a variable to the next.
| ||||||||
comments |
30 | Xcode supports text macros that can be invoked via the Insert Text Macro menu at the end of the Editmenu. They can also be invoked using Code Sense, Xcode's code completion technology. For example, Typing the key sequence p i m control-periodwill insert #import "file"into your code, with fileas an editable token just like with code completion.
| |||
show 1 more comment |
30 | Right click on a variable in your function and click edit all in scope. Been using it a lot since I found this out. ctrl ⌘ T
| ||||||||
comments |
28 | You can have Xcode run the preprocessor over your Info.plist file:<key>CFBundleShortVersionString</key> #ifdef DEBUG <string>1.0 (debug)</string> #else <string>1.0</string> #endif See http://developer.apple.com/technotes/tn2007/tn2175.html for details.
| ||||
|
27 | Debugging - how to use GDB Being new to this still, I find trapping and identifying faults a rather daunting job. The console, despite it being a powerful tool, usually does not yield very intuitive results and knowing what you are looking at in the debugger can be equally difficult to understand. With the help of some of they guys on Stack Overflow and the good article about debugging that can be found at Cocoa With Love it becomes a little more friendly.
| ||||
|
26 | Navigate among open files back and forth: ⌥⌘← ⌥⌘→
| ||||||||||||||||
comment |
25 | Technically an Interface Builder tip, but they're a book-matched pair, so I don't think this is off topic... Shift + Right Click on one of your controls and you get a nice pick list of the object hierarchy. No more click, click, click, frustration!
| |||
22 | With Trackpad: Swipe Three Fingers Up - Switch between header and source file, which is easier than Cmd + Opt + Up; Swipe three fingers down - Switch between declaration and definition when selecting a class or method, found these two kind currently; Swipe three fingers left - Go back (Cmd + Opt + Left); Swipe three fingers right - Go forward (Cmd + Opt + Right); Tested with Xcode 3.2.5.
| |||
21 | The class browser in Xcode! Reached by pressing shift + ⌘ + c. You can reduce the scope to only show your active project. It gives you a less cluttered view as long as you only want to browse the class hierarchy.
| |||
show 4 more comments |
19 | I come from a .NET background, so I'm used to typing a symbol and then typing one of its method names. So I always forget to include the |
share | edited Oct 22 '11 at 17:02 | community wiki 4 revs, 2 users 95% Senseful |
| thanks - this is quite handy! – Faisal Vali Oct 23 '10 at 15:03 |
17 | Select a block of text and type cmd-/ to comment it out. Do it again to remove the comments characters. This is especially useful when combined with brace-matching by double-clicking on balanced chars (parens, braces, brackets).
| |||
show 1 more comment |
16 | Being able to quickly see all the methods that can be overriden from a super class. For example when extending UITableViewController I just type in my implementation:- ta and then I hit ESC to see all the methods from my superclass that begin with "ta" such as - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath This also works when adopting protocols.
| |||
14 | Command ⌘ alt ⌥ shift T : reveal the current edited file in the project tree.
| |||
show 2 more comments |
14 | ctrl + alt + ⌘ + r to clear the log
| ||||||||
|
13 | Apple's API reference documentation does not show methods inherited from a superclass. Sometimes, though. it's useful to be able to see the full range of functionality available for a class -- including a custom class of your own. You can use the Class Browser |
share | answered Oct 22 '08 at 18:21 | community wiki mmalc |
相关文章推荐
- Hidden Features of Xcode
- [Erlang 0040] Hidden Features of Erlang
- Hidden features of C#
- [Erlang 0040] Hidden Features of Erlang
- 关于2006_CVPR_Beyond Bags of Features Spatial Pyramid Matching for Recognizing Natural Scene Categorie
- Visualizing Higher-Layer Features of a Deep Network(经典文章阅读)
- “gjw” is of a model that is not supported by this version of Xcode. Please use a different device.
- Xcode启动失败,提示"Loading a plug-in failed The plug-in or one of its prerequisite plug-ins may be missin
- Multi-Scale Orderless Pooling of Deep Convolutional Activation Features
- 【转载】Step by Step Creation of Crystal Report using its Features Group, Graph, Cross-Tab and Sub Report
- New Features Summary Of Sybase® PowerDesigner® 15.0 For Windows[PD15新功能特征摘要]
- 林轩田之机器学习课程笔记( distilling hidden features之deep learning)(32之29)
- Win2K Kernel Hidden Process/Module Checker 0.1 (Proof-Of-Concept)
- C++14 Is Here: Summary of New Features
- “(null)” is of a model that is not supported by this version of Xcode. Please use a different device
- Bag of Words/Bag of Features的Matlab源码发布(转自丕子)
- Bag of words and Bag of features
- PyCon 2011 - Hidden Treasures of the Python Standard Library - 为Python命令行添加了按键自动补全内容和命令历史功能
- xcode 老是卡在running x of x custom shell scripts编译不过去
- xcodebuild changed some of the values