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

你的呢?


当前回答

选择一个文本块并输入cmd-/将其注释掉。再次执行此操作以删除注释字符。

当通过双击平衡字符(括号、大括号、方括号)与大括号匹配结合使用时,这尤其有用。

其他回答

在选择文本时按住选项可选择文本的不连续部分。 按住选项,同时单击符号名称下拉菜单,按名称排序,而不是按它们在文件中出现的顺序。

⌘-[和⌘-]缩进和取消所选文本。使清理源代码更加容易。

右键单击函数中的变量,然后单击edit all in scope。自从我发现了这个,我就一直在用它。

ctrl⌘T

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

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.

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. 界面构建器手势指南

界面构建器手势指南。