如何让Xcode4中的Object-C代码更加结构化、美观?
我知道 Xcode 提供了本机“结构”功能来重新缩进代码等,但我仍然想在这里提问以寻找更强大的工具或方法来更好地构建我的代码。
有什么想法或线索可以帮助我实现这个目标吗?谢谢
I know that Xcode provides the native "structure" functions to re-indent the code etc, but I still would like to question here to look for more powerful tool or way to structure my code better.
Any ideas or clues for me to achieve this goal ? thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己刚刚开始学习 Objective-C。我相信,改进代码结构最有力的工具是经验和一致的编码风格。
您应该查看 Apple 的 Cocoa 编程编码指南。 http://developer.apple.com/library/ mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html。也许可以查看一些不同的风格指南并找到您喜欢的风格,或者下载由更有经验的程序员用 Objective-C 开发的应用程序的源代码,看看他们如何构建代码。
我不知道有什么自动化工具可以神奇地美化你的代码(尽管我确信它们以某种形式存在),但我真的不认为它们是必要的。
Command+[
将所选行向左缩进一级,Command+]
将所选行向右缩进一级。这就是我所用的。I'm just beginning to learn Objective-C myself. My belief is that the most powerful tools for improving the structure of your code are experience and a consistent coding style.
You should check out Apple's coding guidelines for Cocoa programming. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html. Maybe take a look at a few different style guides and find a style you like, or download the source for an application that has been developed in Objective-C by more experienced programmers to see how they structure their code.
I don't know of any automated tools off the top of my head that will magically beautify your code (although I am sure they exist in some form), but I don't really think they're necessary.
Command+[
indents the selected lines one level to the left, andCommand+]
indents one level to the right. That's all I use.uncrustify 是一个代码美化器。 在这里您将找到一个将其集成到 Xcode 4 中的工具。
uncrustify is a code prettifier. Here you'll find a tool to integrate it in Xcode 4.