随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
当前回答
Cmd-/自动插入“//”进行注释。从技术上讲,敲击键盘的次数相同,但感觉更快……
此外,默认的项目结构是将资源和类文件放在不同的位置。对于大量代码,请创建逻辑组,并将相关代码和xib文件放在一起。在XCode中创建的组只是逻辑结构,不会改变文件在磁盘上的位置(尽管如果你愿意,你可以将它们设置为复制真实的目录结构)
其他回答
⌘命令+双击符号:跳转到符号的定义。
“选项”+双击符号:在符号的“文档”中查找文本。(只有当你安装了他们符号的Doc Set时才有效。)
收藏夹栏:
收藏夹栏就像你在Safari中存储收藏夹一样。我经常用它来存储我现在正在使用的文件的快捷方式(你可以通过拖拽来实现)。一般来说,当我处理一个大型或不熟悉的项目时,这更有用。
要显示收藏夹栏,请选择以下菜单选项:
查看>布局>显示收藏栏
使用xcodebuild命令行在共享构建机器上进行干净的构建:
cd project_directory
xcodebuild -configuration Release -alltargets clean
xcodebuild -configuration Release -alltargets
使用类浏览器显示继承的方法
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.
无需重新编译的调试日志记录
cdespinosa的回答堆栈溢出问题我如何调试与NSLog(@“内部的iPhone模拟器”)?给出了一种不需要重新编译源代码的调试通过日志技术的方法。这是一个神奇的技巧,可以让代码摆脱调试的麻烦,有一个快速的周转,如果我早一点知道它,就可以为我省去无数的麻烦。
TODO comments
在注释前面加上TODO:将导致它显示在函数“快捷”下拉菜单中,例如:
int* p(0); // TODO: initialize me!
再来一个....十六进制选色器… 它添加的十六进制标签到你的界面建设者的颜色面板…现在你可以用 十六进制颜色直接从接口生成器..