Xcode 4 : Opening brace on the same line

2019-03-17 00:31发布

I just installed Xcode 4 and the opening brace of the auto generated functions is on a new line.

For example :

- (void)dealloc
{
  [_window release];
  [super dealloc];
}

I'd like to have the opening brace on the same line like it was in Xcode 3 :

- (void)dealloc {
  [_window release];
  [super dealloc];
}

Can someone help me ?

Thanks.

标签: xcode4
4条回答
走好不送
2楼-- · 2019-03-17 01:07

MarkC's answer has the right idea, but <Jedi> these aren't the templates you're looking for </Jedi>.

The templates you need to edit are in either

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

or

/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Templates

depending on which platform you're targeting.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-17 01:12

All the template code that XCode 4 uses to create new class files is in /Developer/Library/Xcode/Templates/File\ Templates/Cocoa/Objective-C\ class.xctemplate

Just edit those templates to suit your coding style and you are good to go.

查看更多
Anthone
4楼-- · 2019-03-17 01:14

You could try using an application called Snippet Edit that allows you to easily edit all of the supplied code snippets. You will need to be using Xcode v4.3 or later though if you wish to use it.

The application can be found at http://cocoaholic.com/snippet_edit/

查看更多
迷人小祖宗
5楼-- · 2019-03-17 01:20

Don't edit those templates directly! Apple usually automatically deletes them when you upgrade to next version of Xcode...

Instead, you want to copy/paste them into:

~/Library/Developer/Xcode/

e.g.:

~/Library/Developer/Xcode/File Templates/
~/Library/Developer/Xcode/Project Templates/

...and then edit them there. Xcode knows it should look there for your custom versions, and Apple will leave the contents of your home directory alone.

查看更多
登录 后发表回答