开发者

Xcode 4 method indentation

开发者 https://www.devze.com 2023-04-03 15:09 出处:网络
I know there are a LOT of these topics going on everywhere, but I have a more specific question, as the title suggest.

I know there are a LOT of these topics going on everywhere, but I have a more specific question, as the title suggest. So, this is how the editor auto-indents:

        action = [CCSequence actions:[action1],
                  [action2],
                  [action3],
                  [etc],                 
                  nil];

And this is how I'd like it to do it:

        action = [CCSequence actions:[action1],
                                     [action2],
            开发者_高级运维                         [action3],
                                     [etc],

                  nil];

Is there any way to make it show like this? I realize methods with multiple arguments get lined up like that because of the ":"-s

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"aa"
                                               message:@"aa"
                                              delegate:nil
                                     cancelButtonTitle:@"aa"
                                     otherButtonTitles:@"aa", 
                      nil];

but I really love this layout. Searched everywhere, tried Xcode defaults terminal commands but nothing really did the trick. Actually something did the trick, but it's REALLY unnatural to do it like this.

action = [CCSequence actions:[[action1],
                              [action2],
                              [action3],
                              [etc],
                              nil];

If I put that extra [ there, they get lined up where I want them, but I have to go back and delete it, obviously, then reindent the nil]; line.

Any help would be REALLY appreciated. Thank you.


put your code like this:

action = [CCSequence actions:[action1],[action2],[action3],[etc],nil];

then press enter while the cursor is after the first coma. It will become this:

action = [CCSequence actions:[action1],
          [action2],[action3],[etc],nil];

if you push [action2] to align with [action1]:

action = [CCSequence actions:[action1],
                             [action2],[action3],[etc],nil];

the next time you press enter, with the cursor on the second coma, you get this:

action = [CCSequence actions:[action1],
                             [action2],
                             [action3],[etc],nil];

further enters on the comas will keep things aligned.

Is this enough for you?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号