【问题标题】:Can Uncrustify indent multi-line method call in Objective-C?可以在 Objective-C 中 Uncrustify 缩进多行方法调用吗?
【发布时间】:2016-02-29 07:05:44
【问题描述】:

我想要这样的多行方法调用:

[self.markAsFinishedButton
    setBackgroundImage:[UIImage imageWithColor:[UIColor blueButtonColor] andSize:CGSizeMake(1, 1)]
    forState:UIControlStateHighlighted];

但现在,它看起来像这样:

[self.markAsFinishedButton
setBackgroundImage:[UIImage imageWithColor:[UIColor blueButtonColor] andSize:CGSizeMake(1, 1)]
forState:UIControlStateHighlighted];

我的.uncrustify 文件在这里: https://gist.github.com/nickcheng/d107d6f0f74ef381fb8e

顺便说一句,我可以使用这样的配置在作业中获得正确的缩进:

_tapRecognizer = [[UITapGestureRecognizer alloc]
    initWithTarget:self
    action:@selector(controlButtonTapped)];

有人可以帮我吗?谢谢!

【问题讨论】:

    标签: objective-c xcode uncrustify


    【解决方案1】:

    我用了这两个(第二个是用于消息声明的):

    align_oc_msg_colon_span = 10
    align_oc_decl_colon = true
    

    但我通常这样对齐代码:

    [self.markAsFinishedButton setBackgroundImage:[UIImage imageWithColor:[UIColor blueButtonColor]
                                                                  andSize:CGSizeMake(1, 1)]
                                         forState:UIControlStateHighlighted];
    

    【讨论】:

      猜你喜欢
      • 2010-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      相关资源
      最近更新 更多