Xcode 4 : Opening brace on the same line
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.
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.
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.
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.
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/
精彩评论