Xcode:调整自动生成的括号的缩进? [英] Xcode: Adjusting indentation of auto-generated braces?

查看:179
本文介绍了Xcode:调整自动生成的括号的缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由Xcode自动生成的代码默认情况下似乎在同一行上有大括号:

Code auto-generated by Xcode seems to have the opening brace on the same line by default:

@interface Controller : NSObject {

}

我想要一行一行的撑杆,像这样:

I'd like the opening brace on a line of its own, like this:

@interface Controller : NSObject 
{

}

这通常适用于Xcode自动生成的任何方法/类.在Xcode首选项中,我将"Indent solo {by"设置为0:

This applies in general to any method / class auto-generated by Xcode. In Xcode preferences I have "Indent solo { by" set to 0:

我该如何解决?

推荐答案

对于Xcode 3.x,您可以使用以下代码: 如果打开终端会话并输入
defaults write com.apple.Xcode XCCodeSenseFormattingOptions '{ "BlockSeparator" = "\n" ; }'
,它将在新行上启动新的代码块.请注意,如果已打开XCode,则必须重新启动它才能读取和使用新的默认值.

For Xcode 3.x, you can use the following: If you open up a terminal session and enter
defaults write com.apple.Xcode XCCodeSenseFormattingOptions '{ "BlockSeparator" = "\n" ; }'
it will start new blocks of code on a new line. Note that you will have to restart XCode if you have it opened in order for the new defaults to be read and used.

对于Xcode 4.x到6.x(当前),我建议您使用片段编辑方便使用用于编辑定义Xcode自动补全的代码段的工具.目前,它是免费的,并且运行良好.

For Xcode 4.x to 6.x (current) I suggest you use Snippet Edit as a handy tool for editing the snippets that define the Xcode autocompletion. At the current time it's free and works great.

这篇关于Xcode:调整自动生成的括号的缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆