XCode 4 if (self = [super init]) issue

前端 未结 8 1107
野的像风
野的像风 2021-01-02 17:36

I have recently (e.g. just now) upgraded to XCode 4, and I like it overall, however, there is one thing that annoys me.

When I write code like this:

         


        
8条回答
  •  梦谈多话
    2021-01-02 17:59

    You can either put an additional set of parentheses in the if statement

    if ((self = [super init])) {
        ...
    }
    

    Or, you can do as the new templates do.

    self = [super init];
    if(self) {
        ...
    }
    

提交回复
热议问题