随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
当前回答
使用#pragma进行组织
你可以使用:
#pragma mark Foo
... 作为组织源文件中的方法的一种方式。当通过弹出式菜单浏览符号时,无论你在Foo中放置什么,都会在列表中显示粗体。
要显示分隔符(即水平线),使用:
#pragma mark -
它非常有用,特别是在将委托方法或其他方法组分组时。
其他回答
Xcode中的类浏览器!通过按shift +⌘+ c实现。您可以缩小范围,仅显示您的活动项目。只要您只想浏览类层次结构,它就会为您提供一个不那么混乱的视图。
通过命令行控制Xcode的文本编辑器: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
没有多少键盘快捷键,但是源代码中的TODO注释显示在编辑器顶部的方法/函数下拉列表中。
例如:
// TODO: Some task that needs to be done.
在方法和函数的下拉列表中显示,以便您可以直接跳转到它。
大多数Java ide在滚动条中为这些任务标记显示一个标记,这样更好,但这也可以工作。
使用AppKiDo浏览文档。
在Xcode中使用Accessorizer来完成一堆单调、重复的任务。
使用类浏览器显示继承的方法
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.