2

当我编写一个有点复杂的方法时,我更喜欢在它上面添加一个小注释块

/*--------------------------------------------------------------+
| When I wrote this, only God and I understood what I was doing
| Now, God only knows
+-------------------------------------------------------------*/
- (void) overlyDifficultMethodToGrasp { ... }

真的是这样,从我的代码中注释掉这个方法的唯一方法就是 hitcmd + /吗?这会导致

///*--------------------------------------------------------------+
// | When I wrote this, only God and I understood what I was doing
// | Now, God only knows
// +-------------------------------------------------------------*/
//- (void) overlyDifficultMethodToGrasp { ... }
//    

我想做的是

/*
/*--------------------------------------------------------------+
 | When I wrote this, only God and I understood what I was doing
 | Now, God only knows
 +-------------------------------------------------------------*/
- (void) overlyDifficultMethodToGrasp { ... }
*/

如您所见,这不起作用...

为什么?好吧,我认为大块//很丑!

4

2 回答 2

4

这与 Xcode 没有太大关系,但与您使用的语言(和编译器)有关。你不能像 C 或 Objective-C 那样嵌套注释块。

于 2013-04-25T10:20:43.257 回答
3

正如 DrummerB 指出的那样,您不能嵌套评论。

使用 // 代替 /*

这里:

/*

//--------------------------------------------------------------+
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
//+-------------------------------------------------------------+

- (void) overlyDifficultMethodToGrasp { ... }
*/
于 2013-04-25T10:29:36.623 回答