随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。

你的呢?


当前回答

获取Colin Wheeler的完整Xcode键盘快捷键列表(PDF或PNG格式)。把它打印出来,放在显眼的地方(我把它贴在屏幕旁边的墙上)。

编辑: Xcode 3.2的更新版本

编辑2: Xcode 4的更新版本

其他回答

1. "objc_exception_throw"的断点

在objc_exception_throw上应该始终有一个断点。

2. 调试“僵尸”变量的保留/释放问题

使用以下代码:

NSZombieEnabled = YES;
NSDeallocateZombies = NO;

... 调试保留和释放问题。要了解更多信息,请参阅Apple调试应用程序文档中的“查找内存泄漏”部分。

3.从Interface Builder跳转到Xcode中的类

命令⌘+双击接口生成器的文档窗口中的对象,跳转到Xcode中的该类。这对于File's Owner来说非常方便。

4. 在接口生成器中重用自定义对象

将自定义对象拖回接口生成器的库以供以后重用。

5. 在“接口生成器”中选择重叠项

控制⌃Shift +在Interface Builder中点击一个对象,可以看到鼠标下所有对象的菜单。

6. 界面构建器手势指南

界面构建器手势指南。

切换到头文件/源文件

选项命令⌘向上箭头↑ 查看>切换到头文件/源文件

在。m和。h文件之间切换。

在Xcode 4中,这是ctrl⌘向上箭头↑

使用类浏览器显示继承的方法

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 (from the Project menu) to display a flat or hierarchical list of all the classes related to a current project. The upper pane on the right hand side of the browser window shows a list of methods associated with the object selected in the browser. You can use the Configure Options sheet to select "Show Inherited Members" to show inherited methods as well as those defined by the selected class itself. You click the small book symbol to go to the corresponding documentation.

Cmd+Option+O to open a file in a separate window. Can configure Tab to always indent. I frequently use it to indent an entire file. Ctrl+Arrow keys to move between camel case words. If you have OneTwo, you can move from One to Two with Ctrl+Right arrow. You can use emacs bindings, there's even kill ring! I use the Ctrl+w and Cmd+C together when I need to copy two different pieces of text. In the documentation browser, you can restrict your searches to a particular library, e.g., just iOS 4.2 library. This helps me focus on API available only on a particular iOS/Mac version of the SDK. Cmd+Shift+A to build and analyze.

我发现使用快捷方式来构建/清理和运行你的项目真的节省了我一些时间:

Cmd-R:构建并运行 Cmd-Y:构建和调试 Cmd-Shift-Enter:停止运行项目 Cmd-Shift-K:清洁构建