Xcode 4 : Opening brace on the same line

后端 未结 4 637
南方客
南方客 2021-02-06 18:49

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];
  [         


        
相关标签:
4条回答
  • 2021-02-06 19:03

    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.

    0 讨论(0)
  • 2021-02-06 19:07

    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.

    0 讨论(0)
  • 2021-02-06 19:18

    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.

    0 讨论(0)
  • 2021-02-06 19:23

    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/

    0 讨论(0)
提交回复
热议问题