Objective-C中的单个下划线显然是为Apple的"内部"使用保留的(并且在Apple声明之前可用于私有实例变量).但是为什么他们会在他们的SQLiteBooks示例中为iPhone 使用双 -underscore呢?请参阅从MasterViewController.m获取的此片段:
+ (EditingViewController *)editingViewController {
// Instantiate the editing view controller if necessary.
if (__editingViewController == nil) {
__editingViewController = [[EditingViewController alloc] initWithNibName:@"EditingView" bundle:nil];
}
return __editingViewController;
}
Run Code Online (Sandbox Code Playgroud)
在这个论坛上提到了双重下划线,因为它与C有关 - 它是"compier的内部使用".我想我不知道这在这种情况下是如何适用的.
我在我的应用程序中需要一个ViewController,它的行为与SQLiteBooks示例项目中的一样,但是这个双下划线让我感到困惑.